F
Filamentβ€’12mo ago
gemini.dev

SelectFilter show full name

I currently have this filter added in: SelectFilter::make('agent_id')->label('Agent')->relationship('filamentUser', 'first_name') It only shows me first_name values. I need to show both first_name and last_name. How can I achieve this?
10 Replies
Lara Zeus
Lara Zeusβ€’12mo ago
you can use ->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->first_name} {$record->last_name}")
gemini.dev
gemini.devOPβ€’12mo ago
Just tried using it, but there is no definition found.
No description
Lara Zeus
Lara Zeusβ€’12mo ago
not sure when this introduced! maybe update filament to last version
No description
gemini.dev
gemini.devOPβ€’12mo ago
Hmm intresting, what version are you using?
Lara Zeus
Lara Zeusβ€’12mo ago
you are in a table definition right?
return $table
->filters([
SelectFilter::make('author')
->relationship('author', 'name')
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->first_name} {$record->last_name}")
->searchable(),
return $table
->filters([
SelectFilter::make('author')
->relationship('author', 'name')
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->first_name} {$record->last_name}")
->searchable(),
Version ...................................... v3.1.18 use Filament\Tables\Filters\SelectFilter;
gemini.dev
gemini.devOPβ€’12mo ago
Ah this might explain it
No description
Lara Zeus
Lara Zeusβ€’12mo ago
ooh you in version 2 πŸ™‚ hope it's supported, I dont remember
gemini.dev
gemini.devOPβ€’12mo ago
I am currently upgrading now πŸ™‚ Bit of a paint to upgrade not gonna lie lol
Lara Zeus
Lara Zeusβ€’12mo ago
lol it depends on your app, but the upgrade script helps a lot
gemini.dev
gemini.devOPβ€’12mo ago
Kinda new to filament at the moment. Just took over someone else's project lol
Want results from more Discord servers?
Add your server