Kevin.a
Kevin.a

Reputation: 4296

Laravel link_to_route function

I have this bit of code:

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

As you can see i used the link_to_route function. I defined this Route in this bit of code:

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

Route::get('register',[
'as' => 'get_register',
'uses' => 'Auth\AuthController@get_register'
    ]);

Route::post('register',[
'as' => 'post_register',
'uses' => 'Auth\AuthController@post_register'
    ]);


});

Now when i go to my page in the browser i get the following error:

http://prntscr.com/cniild

Anything that could help would be highly appreciated.

Thanks in advance,

-Kevin

Upvotes: 1

Views: 1453

Answers (2)

Dwight
Dwight

Reputation: 12450

link_to_route was part of the Laravel HTML library which was removed in Laravel 5. It is now maintained by Laravel Collective, so you will need to install their package to use that function. Camilo's solution is the standard way to link to named routes now.

Upvotes: 1

Camilo Rojas
Camilo Rojas

Reputation: 668

You can use a

<a href="{{ route('get_register') }}">Register</a>

I hope this help

Upvotes: 1

Related Questions