F
Filamentβ€’2y ago
RobinDev

custom page access

How can i set a gate/access for a custom page? I only want people with a specific role to be able to visit that page
11 Replies
Dennis Koch
Dennis Kochβ€’2y ago
I think via mount method? It's a standard LW component
RobinDev
RobinDevOPβ€’2y ago
how would you do that I want it to also be removed from the navigation
pechtelt
pechteltβ€’2y ago
@RobinDev For navigation you can use shouldRegisterNavigation() and return an bool. or create a policy
Dennis Koch
Dennis Kochβ€’2y ago
Policies are not meant for pages
AlexAnder
AlexAnderβ€’2y ago
I use filament shield and then on custom page add "use HasPageShield;" and on role select specific role to access to custom page
pechtelt
pechteltβ€’2y ago
Just starting... πŸ™‚ But then i think i'm using it in the wrong way bc if in UserPolicy, for example, I return the function update() false then you don't have access to update the model but then you can't access the /edit page either. Or am I abusing this?
Dennis Koch
Dennis Kochβ€’2y ago
But your edit page is part of a resource? It works with resources but not with custom pages
pechtelt
pechteltβ€’2y ago
Right! Ah, question misunderstood! Thanks!
Paul Mercado
Paul Mercadoβ€’7mo ago
What if the custom page is inside the resource? hasPageShield is not working. I am using Filament-shield. I want to restrict users for accessing the custom page inside the ex. EmployeeResource folder
ianclemence
ianclemenceβ€’6mo ago
Hi, did you get a solution for this? I'm facing a similar challenge
Want results from more Discord servers?
Add your server