How can I search in hidden fields?
Hi
I use uuid as id for some tables and I don't display the id in the list.
Is there a way to search in this field anyway?
2 Replies
you can add it to the searchable() array of a different column
ok... will see if I can make it work
TextColumn::make('name')->sortable()->searchable(
query: function (Builder $query, string $search): Builder {
return $query
->where('name', 'like', "%{$search}%")
->orWhere('id', 'like', "%{$search}%");
}),
but it does not work
aha... wait... i have a global scope... how do I remove that
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()->withoutGlobalScopes();
}
all good, thanks