F
Filament16mo ago
Sesh

How to search in multiple fields in v3 SelectFilter?

I am using the following relationship select filter:
SelectFilter::make('players')
->label(__('Players'))
->relationship('players', 'name_en')
->searchable()
->multiple()
SelectFilter::make('players')
->label(__('Players'))
->relationship('players', 'name_en')
->searchable()
->multiple()
When I enter a search query in the select filter it should not only find results with a match on "name_en" but also on "shortname_en". What I tried: - Add an array of searchable columns to ->searchable(['name_en','shortname_en']) as it would work in the form select => Did not work - Use a virtual column => Did not work properly because there is not always a value in shortname_en (its nullable) so the virtual is empty in this case - Using a custom attribute on the model => Didn't work as Filters are doing a direct sql query Anybody has an idea how to make the Filter search also search in "shortname_en"?
1 Reply
Want results from more Discord servers?
Add your server