Form Select Component doesn't want to take default() value

Hi, Im creating Select in my form

Forms\Components\Select::make('email')
->options(function () {
return User::all()->pluck('email', 'id');
})->default(auth()->user()->id)
->required()

Forms\Components\Select::make('email')
->options(function () {
return User::all()->pluck('email', 'id');
})->default(auth()->user()->id)
->required()
Select doesnt react to any changes that I apply. My end goal is to create select with all users email- but when record is already created i want to pass these user email as default. Options method seems fine, I have all options with proper values and names.
6 Replies
Dan Harrin
Dan Harrin15mo ago
are you on the create or edit page
Magikstah
Magikstah15mo ago
Edit page
Dan Harrin
Dan Harrin15mo ago
defaults are filled on the create page why is the user not in the database by that point?
Magikstah
Magikstah15mo ago
I mean everything is filled at this point, if i create for example TextInput there email will fill input, but by creating select component i have placeholder selected
Dan Harrin
Dan Harrin15mo ago
pluck(‘email’, ‘email’) ? you shouldnt need default()
Magikstah
Magikstah15mo ago
I've removed vendor and poped composer install and filament upgrade and everything seems working without default
Want results from more Discord servers?
Add your server
More Posts