How to render admin panel navigation item only for selected users

I'm facing some difficulties when trying to access my authenticated user's data in AdminPanelProvider. In my specific case I want to use Filament Debugger plugin (that adds panels to Telescope, Horizon and Pulse) only for super_admin role from Shield, but examples like "display Birthday Panel" would be more than enough if anyone has one! The code I'm trying with is: $panel->plugin(DebuggerPlugin::make()) Which is working for all users, but when I try to wrap it in auth()->user()?->hasRole('super_admin') condition, it always returns Null and panel is never available. I've tried to dd() a couple options, but nothing worked
3 Replies
LeandroFerreira
I think you can use this same approach creating a custom middleware
GitHub
User specific requiresMultiFactorAuthentication · filamentphp fi...
Package Panel builder Package Version v4.0.8 How can we help you? Is it possible to provide a user specific value for requiresMultiFactorAuthentication on a panel? (or isRequired parameter of multi...
Xanax81
Xanax81OP4w ago
Thanks for the suggestion! I've tried adding the Nav items in the middleware - now my user role can indeed be verified, although the execution seem to occur after the whole panel is rendered, so there are no errors, but I still can't see my menu items. I've read middleware is good for aborting unauthorised access, but can't quite add anything to the panel structure. Do you by any chance have more ideas? I really want to avoid creating another admin panel just to include Debuggers
No description
LeandroFerreira
do you mean, this plugin ?
Filament
Debugger by Stephen Jude - Filament
Easily add Laravel Telescope and Laravel Horizon to admin panel.

Did you find this page helpful?