© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Dhaval Kacha

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');
return $user->hasRole('admin');
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Logger plugin only for super_admin
FilamentFFilament / ❓┊help
2y ago
Translate is not working on only NavigationItem in AdminpanelProvider
FilamentFFilament / ❓┊help
2y ago
i want to make a few options available only for admins
FilamentFFilament / ❓┊help
3y ago
Adminpanelprovider file missing
FilamentFFilament / ❓┊help
2y ago