© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
11 replies
Josh777

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;
                });
            }
        });
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
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to hide dashboard from "Dashboard" depending on user role?
FilamentFFilament / ❓┊help
16mo ago
show/hide field depending on data load?
FilamentFFilament / ❓┊help
3y ago
Modifying shared resources depending on the panel
FilamentFFilament / ❓┊help
3y ago
Hide a Toggle field depending on Select option
FilamentFFilament / ❓┊help
3y ago