F
Filament5mo ago
QCTFW

Can I define an extra searchable column without creating a column in the table?

So I want a column to be searchable but I defined the column in the description method.
TextColumn::make('book.name')
->label('Book')
->lineClamp(2)
->description(fn (BookBorrow $record) => str('`' . $record->book->isbn . '`')->inlineMarkdown()->toHtmlString())
->searchable()
->sortable()
TextColumn::make('book.name')
->label('Book')
->lineClamp(2)
->description(fn (BookBorrow $record) => str('`' . $record->book->isbn . '`')->inlineMarkdown()->toHtmlString())
->searchable()
->sortable()
How to make the value isbn also searchable?
Solution:
You can set array param in searchable like : ```php TextColumn::make('book.name') ->label('Book') //......
Jump to solution
3 Replies
Vp
Vp5mo ago
Solution
Julien B. (aka yebor974)
You can set array param in searchable like :
TextColumn::make('book.name')
->label('Book')
//...
->searchable(['name', 'isbn'])
->sortable()
TextColumn::make('book.name')
->label('Book')
//...
->searchable(['name', 'isbn'])
->sortable()
QCTFW
QCTFWOP5mo ago
How did I missed that? 🤦‍♂️ Thank you, @Vp @yebor974. It works!
Want results from more Discord servers?
Add your server