How to Hide Panel Icons Based on User Roles and Order Panels
I'm working on a Laravel Filament project with multiple panels, and I need to customize the visibility of these panels based on user roles. Specifically, I want to:
Hide panel icons if a user’s role doesn’t have access to that panel.
Maintain a specific order for the panel display.(admin, doctorants,.)
Here’s my current setup:
I'm using the bezhansalleh/filament-shield package for role management.
Each user can have access to multiple panels, and I store panel access information in a panel_accesses table, which associates roles with panel IDs.
Could anyone please provide guidance or examples on how to achieve this? Any help would be greatly appreciated!
Hide panel icons if a user’s role doesn’t have access to that panel.
Maintain a specific order for the panel display.(admin, doctorants,.)
Here’s my current setup:
I'm using the bezhansalleh/filament-shield package for role management.
Each user can have access to multiple panels, and I store panel access information in a panel_accesses table, which associates roles with panel IDs.
Could anyone please provide guidance or examples on how to achieve this? Any help would be greatly appreciated!
Solution
Finally: ),
The solution was to use the excludes() method,
https://filamentphp.com/plugins/bezhansalleh-panel-switch#panel-exclusion
AppServiceProvider:
User:
PanelAccess
Thank you!
:fi:
The solution was to use the excludes() method,
https://filamentphp.com/plugins/bezhansalleh-panel-switch#panel-exclusion
AppServiceProvider:
User:
PanelAccess
Thank you!
