What I want is I can use different controller for same route based on logged in user's role, so if user logged in with role of admin I want controller for given url is loaded from Admin namespace. I've done like this
Route::group(['middleware'=>['install','auth']],function(){
$role = \Auth::user()->role;
switch ($role)
{
case 'admin':
$prefix = 'Admin\\';
break;
case 'Foo':
$prefix = 'Foo\\';
break;
}
Route::resource('/foo',$prefix.'FooController');
//.......
But is says that Auth::user() is null, is there another approach to do this?