Conditionally hiding user navigation items
In the documentation there is a description of how to hide the main menu items (NavigationItem visible/hidden). However, this does not work for the user menu in the top right corner (userMenuItems -> MenuItem).
I would like to conditionally display these items depending on user permissions. How do I do this?
Solution:Jump to solution
OK, it looks like there will be such an option soon https://github.com/filamentphp/filament/pull/7477/commits so the question will be out of date in a while.
GitHub
Feature: hide menu item by sumardi · Pull Request #7477 · filamentp...
Changes have been thoroughly tested to not break existing functionality.
New functionality has been documented or existing documentation has been updated to reflect changes.
Visual changes are ex...
3 Replies
Use Policies
https://laravel.com/docs/10.x/authorization
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Yes, I use shield. A normal user won't access this address but the menu item won't disappear, it's all about hiding the item.
Solution
OK, it looks like there will be such an option soon https://github.com/filamentphp/filament/pull/7477/commits so the question will be out of date in a while.
GitHub
Feature: hide menu item by sumardi · Pull Request #7477 · filamentp...
Changes have been thoroughly tested to not break existing functionality.
New functionality has been documented or existing documentation has been updated to reflect changes.
Visual changes are ex...