How to set home for different user roles Greetings,
I have a roles and permission and I am using gates with authorization in my app. I would like to set different home for different roles. Is there any recommended way to do it?
Your help is much appreciated. :)
@0re1 This isn’t an authorization problem. You would do this in your controller based on the user’s role:
switch ($user->type) {
case 'admin':
return view('dashboard.admin');
case 'moderator':
return view('dashboard.moderator');
default:
return view('dashboard.default');
}
You can take a look in the RedirectIfAuthenticated class that is located inside the middleware folder. I think that is the correct class.
Please sign in or create an account to participate in this conversation.