filament-plugin-tools

On this page

Add a trait

Simple all you need is to add the needed trait to your plugin, for example if you eant your users to ccustomize the navigation group label, add the trait to you plugin.

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

then set the default navigation group label:

1protected string $navigationGroupLabel = 'Awesome';

and in your resource:

1public static function getNavigationGroup(): ?string
2{
3 return MyAwesomePlugin::get()->getNavigationGroupLabel();
4}

Now, if your users want to set the navigation group label:

1public function panel(Panel $panel): Panel
2{
3 return $panel
4 // ...
5 ->plugins([
6 MyAwesomePlugin::make()
7 ->navigationGroupLabel('New Awesome'),
8 ]);
9}

For more, check the available traits and how to use each one of them.