Get relationship in select
a user hasOne profile, how can i show the user.profile.first_name and user.profile.last_name instead of the 'name' of the users table?
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('status')
->options(ProcessStatus::class),
Forms\Components\Select::make('user_id')
->label('User')
->options(User::all()->pluck('name', 'id'))
]);
}
2 Replies
Maybe not the simplest or most ideal way, but it works.
when your database implements concat()
thank you