I'm not sure if this is a good or bad practice, but I'm trying to load the same route using a different controller / method depending on the role of the user.
Tried to do some role filtering, as shown below, but not sure if this is the way:
Route::group(['before' => 'role:admin'], function() {
Route::get('/', 'FirstController@index');
});
Route::group(['before' => 'role:editor'], function() {
Route::get('/', 'SecondController@index');
});
Route::filter('role', function($route, $request, $value) {
});
But I do not work. How can i do this?
EDIT
Found this thread: Laravel same route, different controller
But the accepted answer is:
if( ! Auth::check())
Always returns false in routes.php
source
share