Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

0re1's avatar
Level 1

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. :)

0 likes
2 replies
martinbean's avatar
Level 80

@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');
}
1 like
ilaurens's avatar

You can take a look in the RedirectIfAuthenticated class that is located inside the middleware folder. I think that is the correct class.

Please or to participate in this conversation.