F
Filamentβ€’4mo ago
jjo63

Hide Resources from Panel

Hi I am sure this is simple but cannot see how this is achieved. Say I have a resource "pets" - I get a number of php dfiles generated for this and a link is added to the admin panel - this all happens automatically. I'm doing POC stuff and I'd like to keep what I have (code for reference) but not have the resources cluttering up my admin panel - what's the method (short of deleting the files) to remove them from the view of the user? I guess one option would be to create a new Laravel app πŸ™‚ or to create a new admin panel - but just wanted to know if there is a simple way to achieve the hiding of resources that you don't actually want to see? thanks j
3 Replies
IamJohnDev
IamJohnDevβ€’4mo ago
Hi, I think you need a Role / Permission for this to hide a resource from the user by their role or you can add this line of code inside your Resource
protected static bool $shouldRegisterNavigation = false;
protected static bool $shouldRegisterNavigation = false;
and if you want to use the Role / Permission based for it you can try to use this plugin https://filamentphp.com/plugins/bezhansalleh-shield
Filament
Shield by Bezhan Salleh - Filament
The easiest and most intuitive way to add access management to your Filament Panel's Resources, Pages & Widgets through spatie/laravel-permission.
Dennis Koch
Dennis Kochβ€’4mo ago
$shouldRegisterNavigation should be the easiest solution
jjo63
jjo63OPβ€’4mo ago
Perfect - it is exactly what I needed! Many thanks. I also see now where this subjct is described in the documentation - https://filamentphp.com/docs/3.x/panels/navigation#disabling-resource-or-page-navigation-items
Want results from more Discord servers?
Add your server