Страницы · Laravilt
Configuration
Configure global search on a panel and register searchable resources.
Panel builder
$panel->globalSearch() receives a Laravilt\AI\Builders\GlobalSearchBuilder:
php
| Method | Default | Description |
|---|---|---|
enabled(bool) / disabled() | enabled | Toggle search |
withAI(bool) / withoutAI() | off | Use AI to understand queries |
limit(int) | 5 | Results per resource |
maxResults(int) | 25 | Total results |
debounce(int) | 300 | Input debounce in milliseconds |
shortcut(string) | cmd+k | Keyboard shortcut |
endpoint(string) | {panel}/global-search | Search endpoint URL |
using(Closure) | none | Custom search handler |
exclude(array) | [] | Resources to leave out |
Config defaults
config/laravilt-ai.php also has a global_search section:
php
GlobalSearch service
Laravilt\AI\GlobalSearch is the search engine behind the /laravilt-ai/search endpoint. You can use it directly:
php
search() returns a collection of groups, each with resource, label, icon and results.
Endpoint
text
Both routes use the web and auth middleware.