Form select not updating options data

so i was creating color from inside a Select components using createOptionForm(), I am expecting the data to return with the new created color, but its not returning it. code
Forms\Components\Select::make('color_id')
->label(__('vehicle.attributes.color_id'))
->placeholder(__('vehicle.placeholders.color_id'))
->native(false)
->searchable()
->options(
VehicleInfo\Color::all()->mapWithKeys(fn ($color) => [
$color->id => "<span class='flex items-center gap-x-4'>
<span class='rounded-full w-4 h-4' style='background-color: {$color->color};'></span>
<span>{$color->name}</span>
</span>",
])
)
->reactive()
->createOptionForm([
Forms\Components\TextInput::make('name')
->required(),
Forms\Components\ColorPicker::make('color')
->required(),
])
->createOptionUsing(function (array $data) {
$color = VehicleInfo\Color::create($data);

return $color->id;
})
->allowHtml()
->required(),
Forms\Components\Select::make('color_id')
->label(__('vehicle.attributes.color_id'))
->placeholder(__('vehicle.placeholders.color_id'))
->native(false)
->searchable()
->options(
VehicleInfo\Color::all()->mapWithKeys(fn ($color) => [
$color->id => "<span class='flex items-center gap-x-4'>
<span class='rounded-full w-4 h-4' style='background-color: {$color->color};'></span>
<span>{$color->name}</span>
</span>",
])
)
->reactive()
->createOptionForm([
Forms\Components\TextInput::make('name')
->required(),
Forms\Components\ColorPicker::make('color')
->required(),
])
->createOptionUsing(function (array $data) {
$color = VehicleInfo\Color::create($data);

return $color->id;
})
->allowHtml()
->required(),
1 Reply
Rolland
Rolland4w ago
clarifications: the new created color not load in the Select dropdown. bump
Want results from more Discord servers?
Add your server