Hide all resources depending on user

Is there a quick way to revoke all access to resources if for example, the current logged in user does not have in_admin:1 on their model?

I currently 'hide' them by doing the following in my AppServiceProvider, essentially rendering an empty nav:

view()->composer('*', function ($view) { if (!auth()->user()->is_admin) { Filament::navigation(function (NavigationBuilder $builder): NavigationBuilder { return $builder; }); } });

However, if I navigate to /posts, I will still be able to access the resource anyway.

I guess what I'm asking is how can I do this without creating a policy for every one of my models, and have some sort of global gate that wraps around resources somewhere to check the user state.

Posted this on the Github Discussions, but haven't had a response.

Cheers all

https://github.com/filamentphp/filament/discussions/6983
Was this page helpful?