is it possible to use single login page to redirect to their own panel based on role?

Im building an intern management app where there will be 3 roles such as admin, mentors, and interns. im really wondering if you could use just a single login page then redirects them to their own panel based on their role? bare with me cause im really new to filament and laravel, thank you
13 Replies
awcodes
awcodes2mo ago
Middleware is where you would want to handle this. But you’ll need to look into unifying the authentication of filament since panels are scoped to their own login routes out of the box. But it can be done.
TegarJK
TegarJK2mo ago
i dont know if anyone ever unifying the auth of filament before. but is there a guide in the documentation?
awcodes
awcodes2mo ago
There’s not a guide because it’s not really a filament concept but more of a laravel concept. Filament defaults to the Laravel authentication process.
TegarJK
TegarJK2mo ago
i see, but i really dont understand, i guess ill just add index homepage where there will button for each role login page
awcodes
awcodes2mo ago
A middleware will have the authenticated user meaning you can check their roles/permissions and issue a redirect to the appropriate panel. But you’ll need to include that middleware on each panel provider.
TegarJK
TegarJK2mo ago
Sorry if out of topic but for filament do you reccomend using filament shield plugin or spatie permission , im so confused about the difference beteween the two
LeandroFerreira
LeandroFerreira2mo ago
GitHub
Redirect to page after login? · filamentphp filament · Discussion #...
Package Form builder Package Version v3.0.0 How can we help you? Is there any option to redirect the user to a specific page after login(every time) for one of the roles? We have three roles: admin...
LeandroFerreira
LeandroFerreira2mo ago
You can try both and decide which is best for your project.
TegarJK
TegarJK5w ago
@Leandro Ferreira @awcodes thank you for teaching me a newbie in this tech filed and God bless (story time ,,actually im an intern in a pharma company and they told me to build an intern management app by myself in 3 months 🥹 )
LeandroFerreira
good luck ✌️
SimonH
SimonH5w ago
I was looking for the same functionality and came accross this video https://www.youtube.com/watch?v=9hRgCjDQDGw Goes throught the solution in a bit more detail but at the core it uses @Leandro Ferreira method of creating a CustomLoginResponse class
Filament Daily
YouTube
Filament Roles: Single vs Multiple Panels Example
A 2-in-1 example of implementing roles: in the same panel or in separate panels? Also, building a common login form or not? - Source for single panel: https://filamentexamples.com/project/filament-roles-in-sign-up-and-different-resources - Source for multiple panels: https://filamentexamples.com/project/filament-roles-with-multiple-panels - Ori...
LeandroFerreira
yep, same approach
SimonH
SimonH5w ago
I wonder if this can be extended so that a user with multiple roles would get directed to a configured 'default' panel, and if we can have a picker that will allow a user to pick from any panel they have access too.
Want results from more Discord servers?
Add your server