Global Search
Add your resources to the Evolve global search
Implement the Searchable interface
Your models should implement the Searchable interface and define the following functions:
php
public function scopeSearch(Builder $query, string $keyword)
{
// Eloquent query to search for a given `$keyword`
}
public function getSearchableTitle(): string
{
// Define the title for a search result
}
public function getSearchableDescription(): ?string
{
// Define the description for a search result
}
public function getSearchableAdminUrl(): string
{
// Define the backend route for when a user
// clicks on a search result in the control panel
}Register searchable models
Register your searchable models in config/evolve.php or in the module registration searchable option:
php
Evolve::registerModule('blog', [
// ...
'searchable' => [
Post::class,
]
]);