Shared panel session
I want my AdminPanel to be the default one. and ClinicPanel should no be accessible not unless if someone logs in as admin, If the admin logs in with no SUPER_ADMIN role should be redirected and use the ClinicPanel
4 Replies
Did you find a way to make this work?
Did you try to use the canUsePanel() from User model?
👋
I've similar case in my project (one panel for Users and another for admin and super_admin) and I wanted to use the same login form.
Here's how I did it (it may not be the best way, but it works 😅)
I use the method
canAccessPanel
in my User Model like this :
And in my web.php
route file I've made a little change for the base URL :
And I've made a little helper to manage the redirection :
So, from the same form and according to your role, you're directed to the right panel. 👍Hi guys sorry for the late reply on this thread.
In my case both are admin users but they vary on roles.
What I did was the
AdminPanelProvider
will be the default provider and login()
is enable on the panel. But on the ClinicPanelProvider
the login()
is not enabled.
I added middleware for the admin panel AdminAccessMiddleware::class
and ClinicAccessMiddleware::class
for the clinic panel.
so whenever a a users with a clinic admin
roles logs in. the panel is smart enough to redirect them on the clinic panel which also handles the tenancy.
Panel should share the same session if you use the same auth guard
which in my case is.