In AdminPanelProvider I want Plugin (FilamentSpatieRolesPermissionsPlugin) only be loaded for admin.

In my AdminPanelProvider I want a Plugin (FilamentSpatieRolesPermissionsPlugin) only be loaded if Auth::user()->hasRole('admin') But whenever I do this, I get: Target class [hash] does not exist. for if(Auth::user()->hasRole('admin')) How would y'all fix this or get a way around it
Solution:
Solved, all you have to is use policies for both Role and Permission. Inside policies write something like return $user->hasRole('admin');...
Jump to solution
1 Reply
Solution
Dhaval Kacha
Dhaval Kacha9mo ago
Solved, all you have to is use policies for both Role and Permission. Inside policies write something like return $user->hasRole('admin');