Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function()
{
Route::get('dashboard', function() {} );
});
Nov 9, 2015
10
Level 2
Combined route group with prefix and auth middleware?
I have a route group with admin URL prefix, that looks like this:
Route::group( [ 'prefix' => 'admin' ], function()
{
Route::get('dashboard', function() {} );
Route::get('settings', function() {} );
});
But I want to combine this with using the auth middleware, but this didn't work:
Route::group( [ 'prefix' => 'admin' ], [ 'middleware' => 'auth', function()
{
Route::get('dashboard', function() {} );
});
What is the correct way to do this? Do I have to do two route groups?
Level 56
30 likes
Please or to participate in this conversation.