F
Filamentβ€’2y ago
benshawuk

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
Dan Harrin
Dan Harrinβ€’2y ago
inside a Laravel policy
benshawuk
benshawukOPβ€’2y ago
Thanks, Dan. I'll read up on those in more detail. And also, thanks for making a great product - I'm loving Filament! πŸ™‚
Dan Harrin
Dan Harrinβ€’2y ago
glad you like it :)
benshawuk
benshawukOPβ€’2y ago
Awesome! I have it working! πŸ˜„ Thanks again!!!
Want results from more Discord servers?
Add your server