Restrict access to resource with Spatie
I have Spatie installed and have created an "admin" role.
I can then add my seeded users to that role, where required.
How do I use ->hasRole('Admin'); to allow access to a resource (and deny if the user doesn't have that role)? So that it isn't accessible and doesn't show up in the navigation side bar unless the user has that role?
I don't need to do anything more fancy than that, and don't need to block the entire admin panel using public function canAccessFilament():, but just particular resources.
5 Replies
inside a Laravel policy
Thanks, Dan. I'll read up on those in more detail.
And also, thanks for making a great product - I'm loving Filament! π
Filament
Getting started - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
glad you like it :)
Awesome! I have it working! π Thanks again!!!