F
Filamentβ€’16mo ago
Albert Lens

Concat 2 fields in 1 columns and be searchable

Hello. I am showing 2 phone nos in 1 columns using:
TextColumn::make('phone_nos')
->getStateUsing(function ($record) {
return $record->phone_no . ' / ' . $record->phone_no02;
})
->label(__('phone_nos'))
->searchable()
->toggleable()
->sortable(),
TextColumn::make('phone_nos')
->getStateUsing(function ($record) {
return $record->phone_no . ' / ' . $record->phone_no02;
})
->label(__('phone_nos'))
->searchable()
->toggleable()
->sortable(),
The problem is only for the search. It throws an error because field "phone_nos" does not exist in the database, obviously. Any suggestions? I need to do this with other kind of info, such as different emails. Tks.
3 Replies
toeknee
toekneeβ€’16mo ago
So adjust the query πŸ˜‰
Albert Lens
Albert LensOPβ€’16mo ago
Thank you very much. Solved.
Want results from more Discord servers?
Add your server