Login user based on Department Panel
Hello Everyone
I hope you're all doing well. I'm currently working on a project and could use some guidance and expertise to help me implement a user registration system with department-based access. I have three different panels: 'hr', 'finance', and 'property,' each with its respective logins. My goal is to allow a superadmin to register new users with their email, password, and department. When a registered user logs in, they should be directed to their designated department panel.
12 Replies
Unfortunately I haven't found a suitable solution for this. I might have to post a question in the official discord server because this goes beyond my knowledge. I imagine it has something to do with the Authentication middleware used internally but I still haven't figure out how to redirect the user on login.
Wow this is massive, Thankyou for having a time to check it out. Do you think I should wait for you to get the response from the officials, or if you can help with an alternative way or method ?
What about using viewAny() ?
Please can you guide through based on your understanding
I got this answer but I doesn't seem to understand the logic
My bad it's redirect, maybe something like this
Also how do you separate the user role in database ?
I have the admin panel who is responsible in registering a new user with email , password and then department ( hr == 1, finance == 2 , property == 3)
Great let me implement the logic
@sadiqgoni13 or you can create a new middleware and verify the user is finance or hr
And inside the hr panel add the VerifyIsHr middleware class in it 🤔
Okay I will do that
I forgot how to check the user role if 1 or 2 but i would do this maybe
And inside the panel i will add this
@sadiqgoni13did you get it to work ?
If not maybe you can use this plugin i just found out https://filamentphp.com/plugins/shane-rosenthal-panel-roles
Filament
Panel Roles by Shane D Rosenthal - Filament
Filament Panel Roles is an intuitive way to ensure all users of a specified panel within Filament v3 is assigned a role during registration and has a specified role using Laravel Middleware.
Solution
I figured it out already
Thankyou very much