Consider you have the method getProfile
in your UserController
, then your route is like this:
Route::controller(['user' => 'App\Http\Controllers\UserController'])
It will generate for you the user/profile
uri with a get http verb.
http://laravel.com/docs/5.0/controllers#implicit-controllers
To clarify, the Route::controllers (plural!) method essentially allows to list a bunch of Route::controller (singular) methods. That is not mentioned in the official doc...
While developing it might be useful to use the console and check the routes. Open your console, go to the root of your Laravel project and type
php artisan route:list
in Laravel 4 it is
php artisan route
In this table you can also see whether a route has a name or not and a lot of other useful information.
micaweb said:
Consider you have the method
getProfile
in yourUserController
, then your route is like this:Route::controller(['user' => 'App\Http\Controllers\UserController'])
It will generate for you the
user/profile
uri with a get http verb.
What will be the html link for that getProfile method? I have tried in this way but it won't work. it throws route not defined exception.
<a href="{{ route('user.getProfile',$user->id) }}" > >~~~ What is wrong with this?
Here is the add-back code, easy implementation:
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community