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:Jump to solution
Solved,
all you have to is use policies for both Role and Permission.
Inside policies write something like
return $user->hasRole('admin');
...1 Reply
Solution
Solved,
all you have to is use policies for both Role and Permission.
Inside policies write something like
return $user->hasRole('admin');