I use the Laravel 3 and I'm start a project using Laravel 5.1, a lot of things changes, include some way that I use to make my routes.
I like to implemente my routes using my controllers, like the code below:
Route::controller("Search");
Route::controller("Contact");
Route::controller("Login");
Route::get('/', "Inicio@index");
But it's not works in Laravel 5.1, someone knows if this way changes or not exists more?
Thank you.
You can use Route::resource()
method, the first parameter will be the URL prefix and 2nd will be the controller name, like this:
Route::resource('admin-panel', 'AdminController');
Now, say if your controller have a method named login, the URL generated will be admin-panel/login
. There's also an optional 3rd parameter, check laravel docs for details.