© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
1benjam1

Select field : problem with getOptionLabelFromRecordUsing()

Hi ! I'm trying to customize my labels for a Select relationship field but it doesn't work.

// UsersResource.php (Filament Ressource)
Forms\Components\Select::make('interview_by')
  ->relationship('interviewBy', 'firstname')
  ->getOptionLabelFromRecordUsing(fn (User $user) => $user->getNickename())
// UsersResource.php (Filament Ressource)
Forms\Components\Select::make('interview_by')
  ->relationship('interviewBy', 'firstname')
  ->getOptionLabelFromRecordUsing(fn (User $user) => $user->getNickename())

// User.php (Model)
public function getNickename(): string
{
  return "{$this->firstname} {$this->lastname}";
}
// User.php (Model)
public function getNickename(): string
{
  return "{$this->firstname} {$this->lastname}";
}

And the result is blank 🤔
image.png
Solution
You cannot modify the argument name. It must be
$record
$record
not
$user
$user
:

->getOptionLabelFromRecordUsing(fn (User $record) => )
->getOptionLabelFromRecordUsing(fn (User $record) => )
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Select field: How to preload option from getOptionLabelFromRecordUsing()
FilamentFFilament / ❓┊help
3y ago
SelectFilter->getOptionLabelFromRecordUsing
FilamentFFilament / ❓┊help
13mo ago
getOptionLabelFromRecordUsing GetRelation
FilamentFFilament / ❓┊help
3y ago
struggle with select field =_=
FilamentFFilament / ❓┊help
2y ago