Support the ongoing development of Laravel.io →
posted 9 years ago
Views Blade
Last updated 1 year ago.
0
Solution

You need to name your route, like so :

Route::get('dashboard', array('as' => 'dashboard', 'uses' => 'PagesController@showDashboard'));
Last updated 1 year ago.
0

You can also use the action helper when building the link like so:

<a href="{{ action("PagesController@showDashboard") }}">link</a>

It will generate a URL based on the routes table.

Last updated 1 year ago.
0

Thank you both very much! That's very helpful.

Last updated 1 year ago.
0

Please note

<a href="{{ action("PagesController@showDashboard") }}">link</a>

does not work if the controller manages a number of different views

However, you can check the actual routes (rather than url)'s using:

php artisan route:list
Last updated 7 years ago.
0

I prefer to use route() wherevere possible, don't know if it is a common aproach though:

Route::get('dashboard', ['as' => 'dashboard', 'uses' => 'PagesController@showDashboard']);
...
<a href="{{ route('dashboard') }}">Dashboard</a>
Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

zocios zocios Joined 28 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.