Yes, you can customize which attributes are searchable in the Filament AttachAction modal. By default, the modal's search uses the recordTitleAttribute (in your case, account_number), but you can extend this to additional columns.
For Eloquent relations in Filament v4, the getRecordSelectSearchColumns() method (on the Relation Manager) controls which fields are searched in the AttachAction modal.
Here's how to add this to your relation manager:
class AccountRelationManager extends RelationManager
{
// ...
public static function getRecordSelectSearchColumns(): array
{
// Add each column you want to be searchable
return ['account_number', 'display_name'];
}
// ...
}
Explanation:
- By overriding getRecordSelectSearchColumns() and returning an array of column names, Filament will search all listed columns in the Attach modal.
- Now, if you search "S", it will also match any record where the display_name contains "S", not just account_number.
References:
Summary:
Override getRecordSelectSearchColumns() in your relation manager to include both account_number and display_name. This will allow the Attach modal to search both fields as you expect.