Redirecting After Login based on user's role
I'm currently using Filament with Laravel 11, and I’ve set up a single admin panel provider with the login page located at /admin/login. On this page, users with different roles—such as admin, superadmin, and user—can log in.
The issue I'm encountering is that users with the user role are being redirected to the admin panel (/admin) after logging in, which shouldn't happen. For admin and superadmin roles, the redirect to /admin is expected and works correctly. The problem specifically occurs when a regular user logs in—they’re still taken to the admin panel.
For context, I'm also using Filament Shield in this setup.
What I need is:
To customize the login redirect behavior so that users with the user role are redirected elsewhere (e.g., homepage or a user dashboard) instead of the admin panel.
To restrict access to /admin for users with the user role, so that if they try to access it directly, they receive a 403 Forbidden response.
Could you advise how best to implement this behavior within Filament’s authentication flow?
The issue I'm encountering is that users with the user role are being redirected to the admin panel (/admin) after logging in, which shouldn't happen. For admin and superadmin roles, the redirect to /admin is expected and works correctly. The problem specifically occurs when a regular user logs in—they’re still taken to the admin panel.
For context, I'm also using Filament Shield in this setup.
What I need is:
To customize the login redirect behavior so that users with the user role are redirected elsewhere (e.g., homepage or a user dashboard) instead of the admin panel.
To restrict access to /admin for users with the user role, so that if they try to access it directly, they receive a 403 Forbidden response.
Could you advise how best to implement this behavior within Filament’s authentication flow?