I wish to route the same route to different controller base on user type.
Such as
if (Auth::check() && Auth::user()->is_admin) {
Route::get('/profile', 'AdminController@show');
} elseif (Auth::check() && Auth::user()->is_superadmin) {
Route::get('/profile', 'SuperAdminController@show');
}
But this doesn't work.
How can I make it works as what I want?
okey you can do that by creating a
route::group
your route group will be like that
I hope that will help you.
You can do this
Controller
But i think its better to use a trait
Then
Then you can do the same as the above but instead of
use this