-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
title: Can Globally Search | ||
weight: 4 | ||
--- | ||
|
||
## Global Search | ||
|
||
you can let your user customize the Global Search for a resource | ||
|
||
to implement this, add the trait to yor plugin: | ||
|
||
```php | ||
class MyAwesomePlugin extends FilamentPluginTools implements Plugin | ||
{ | ||
use CanGloballySearch; | ||
} | ||
``` | ||
|
||
and defined the default searchs: | ||
|
||
```php | ||
public array $defaultGloballySearchableAttributes = [ | ||
AwesomeResource::class => ['title', 'slug'], | ||
]; | ||
``` | ||
|
||
in your resource you can get the configuration like: | ||
|
||
```php | ||
public static function getGloballySearchableAttributes(): array | ||
{ | ||
return MyAwesomePlugin::get()->getGlobalAttributes(static::class); | ||
} | ||
``` | ||
|
||
Now, your users can configure the global search in the panel: | ||
|
||
```php | ||
public function panel(Panel $panel): Panel | ||
{ | ||
return $panel | ||
// ... | ||
->plugins([ | ||
MyAwesomePlugin::make() | ||
->hideResources([ | ||
AwesomeResource::class, | ||
]), | ||
]); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters