filament-plugin-tools

On this page

Global Search

you can let your user customize the Global Search for a resource

to implement this, add the trait to yor plugin:

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

and defined the default searchs:

1public array $defaultGloballySearchableAttributes = [
2 AwesomeResource::class => ['title', 'slug'],
3];

in your resource you can get the configuration like:

1public static function getGloballySearchableAttributes(): array
2{
3 return MyAwesomePlugin::get()->getGlobalAttributes(static::class);
4}

Now, your users can configure the global search in the panel:

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

Zeus is an open-source project. Thanks to my sponsors for helping me maintain this project.