Resources

Global search

⌘K finds pages and records, through each resource's query and policy.

⌘K finds pages and records. A resource with $recordTitleAttribute is searched on that column. If the title is an accessor, or you want more columns, override this.

use Illuminate\Database\Eloquent\Model;

public static function getGloballySearchableAttributes(): array
{
    return ['name', 'sku', 'category.name'];
}

public static function getGlobalSearchResultDetails(Model $record): array
{
    return ['SKU' => $record->sku];
}
The search palette, showing matching pages and recordsThe search palette, showing matching pages and records

Return [] to keep a resource out.

Search runs through getEloquentQuery(), skips a resource the user can't viewAny, and checks view on each record, showing up to 5 per resource. Results link to the view page.

A policy that refuses more than the first 20 matches can hide later ones.

$panel->globalSearch(false) removes it. Try it in the demo: press ⌘K.