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())

// 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 not $user:

->getOptionLabelFromRecordUsing(fn (User $record) => )
Was this page helpful?