F
Filament4mo ago
kabu

Is there a way to make my global search start searching from 3 characters? To optimize the search.

class ClientResource extends Resource { protected static ?string $model = Client::class; protected static ?string $navigationIcon = 'heroicon-o-users'; public static function getNavigationLabel(): string { return ('clients'); // Clave de traducción. } protected static ?int $navigationSort = 1; public static function getModelLabel(): string { return ('client'); // Nombre en singular } public static function getPluralModelLabel(): string { return __('clients'); // Nombre en plural } public static function getGloballySearchableAttributes(): array { return ['name', 'email', 'phone']; // Campos por los que se puede buscar } public static function getGlobalSearchResultDetails(Model $record): array { return [ 'Name' => $record->name, 'Email' => $record->email, 'Teléfono' => $record->phone, ]; }
2 Replies
Hasan Tahseen
Hasan Tahseen4mo ago
you can customize the query of the global search. make some if condition that fit your need.

Did you find this page helpful?