© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
F
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
A
u
t
h
:
:user
(
)
-
>hasRole
(
'admin
'
)
But whenever I do this
, I get
:
Target class
[hash
] does not exist
.
for
if
(
A
u
t
h
:
: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
Join
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
Logger plugin only for super_admin
F
Filament / ❓┊help
2y ago
Translate is not working on only NavigationItem in AdminpanelProvider
F
Filament / ❓┊help
2y ago
i want to make a few options available only for admins
F
Filament / ❓┊help
3y ago
Adminpanelprovider file missing
F
Filament / ❓┊help
2y ago