FatalErrorException:调用未定义的函数link_to_route()

I am a new user of Laravel, I'm just studying and practising, however I have the error below when I run my code

FatalErrorException in 91c2dfaa1622335ef6854835b55abc4fabeefb25.php line 33: Call to undefined function link_to_route()

Below is my controller

Route::get('/',  [
    'as' => 'home',
    'uses' => 'PagesController@home'
]);

route::group(['prefix'=>'auth'], function(){

    route::get('register', [
        'as' => 'get_register',
        'uses' => 'Auth/RegisterController@getRegister'
        ]);

    route::post('register', [
        'as' => 'post_register',
        'uses' => 'Auth/RegisterController@register'
        ]);
});

My tutorial put the controller like the one below

Route::group(['prefix'=>'auth'], function(){
    Route::get('register',[
        'as' => 'get_register',
        'uses' => 'Auth\AuthController@getRegister'
        ]);
    Route::post('register',[
        'as' => 'post_register',
        'uses' => 'Auth\AuthController@postRegister'
        ]);
});

But inside Auth folder, I don't have authcontroller, I only have registercontroller. and this is my link in my navigation

<li>{!! link_to_route('get_register','Register')!!}</li>

link_to_route comes from the HTML/Form Builder package, which is not part of Laravel since version 5.0. If you are on Laravel 5.0 you can use illuminate/html or laravelcollective/html. For > 5.0 you would need laravelcollective/html.

I think your code need to update like:

<li>{!! link_to_route('get_register','Register')!!}</li>

To

<a href="{{ url('register') }}">Register</a>

OR

You need to install a package named "laravelcollective/html": "~5.0"

In your composer.json file, Write this line

"laravelcollective/html": "~5.0"

Then open config/app.php file, In provider array,Write this line:-

'Collective\Html\HtmlServiceProvider',

Next, add these lines to the 'aliases' array:

'Form' => 'Collective\Html\FormFacade',

   'Html' => 'Collective\Html\HtmlFacade',

Hope this work for you!

In Laravel 5 use the route() helper instead of link_to_route():

{!! route('get_register') !!}