filament-plugin-tools

On this page

Hide a Resource

if your plugin has many resources, users can hide them if they needed.

to implement this, add the trait to yor plugin:

1class MyAwesomePlugin extends FilamentPluginTools implements Plugin
2{
3 use CanHideResources;
4}

in your resource you can check if the given resource is hidden:

1public static function shouldRegisterNavigation(): bool
2{
3 return MyAwesomePlugin::isResourceVisible(static::class);
4}

Now, your users can hide any resource:

1public function panel(Panel $panel): Panel
2{
3 return $panel
4 // ...
5 ->plugins([
6 MyAwesomePlugin::make()
7 ->hideResources([
8 AwesomeResource::class,
9 ]),
10 ]);
11}