Using Laravel 4.2, is it possible to assign a name to a resource controller route? My route is defined as follows:
Route::resource(\'faq\', \'ProductFaqCont
For answer seekers with Laravel 5.5+ finding this page:
Route::namespace('Admin')->prefix('admin')->name('admin.')->group(function () {
Route::resource('users','UserController');
});
These options will result in the following for the Resource:
namespace() sets Controller namespace to \Admin\UserController
prefix() sets request URi to /admin/users
name() sets route name accessor to route('admin.users.index')
In
name()the DOT is intended, it is not a typo.
Please let others know if this works in comments for any versions prior to Laravel 5.5, I will update my answer.
Update:
I can confirm that in Laravel 5.3 that the name method is not available.
No confirmation yet if supported in 5.4
Taylor accepted my PR to officially document this in 5.5:
https://laravel.com/docs/5.5/routing#route-group-name-prefixes