Is it possible to disable the entire sidebar based on a user?
I am trying to disable the navigation menu for a specific user (based on their email), but when using the navigation method in the PanelProvider I get an error in the associated view
2 Replies
If you mean hide the sections links, then you can achieve that in different ways:
- Override the
shouldRegisterNavigation()
method in resources.
- Override canAccess()
method in custom pages.
- Model policy.create a middleware. Inside the middleware you can use
auth()->user()
and filament()->getCurrentPanel()->navigation(...)
https://github.com/filamentphp/filament/issues/7288#issuecomment-2061358409GitHub
I cannot access to auth()->user() in panel · Issue #7288 · filament...
Package filament/filament Package Version v3.0.0-beta21 Laravel Version v10.0.0 Livewire Version v3.0.0 PHP Version 8.2.4 Problem description auth()->user() return null in panel class AdminPanel...