I'm not sure if this is good or bad practice, but I'm trying to load the same route with a different controller / method depending on the user role.
Tried to do some role filtering like below, but not sure if this is the way to go:
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) {
// what to do here and is this the right way?
});
But I don't get it to work. How can I accomplish this?
EDIT
Found this thread: Laravel same route, different controller
But the accepted answer:
if( ! Auth::check())
Always returns false in routes.php