Redirect Middleware for multiple panels.
I want to redirect user to their respective panel based on their role using this middleware . I added the middleware in the Admin panel whose path('').I also have the manager panel whose path('manager') that i didn't add the middleware nor added the ->login(). However i keep on getting This page is not working when i try to log in. Sometimes I get Route [login] not defined. I've made an intensive such on the platform and tried every suggestion including creating a custom redirect in web.php but to no avail.
8 Replies
I still get the error on 'manager' logout Route [login] not defined
Got it ,added the ->login() on the manager panel. Thank you .
Though when logged in as admin then i hit the '/manager' , it takes me to the manager panel but with the same admin
you need to restrict access
in the
canAccessFilament()
methodNot really sure how to go about . I do check the role of the user , if 'manager' ? If 'super admin' ?
check panel id and users roles
if('manager'){//what should be here}else if('super admin') {//and here} . sorry for the dumb question but i seem not wrap it up.Suppose the currently logged in is a manager [ viewing MangerPanel] ,should canAccessPanel() return true or false so that he doesn't see the admin panel
$panel->getId() or something similar. Don't remember exactly. Use ide to find