Fill select and select a value with afterStateUpdated

I have tried this, but with a select it does not work correctly: https://filamentphp.com/docs/3.x/forms/advanced#generating-a-slug-from-a-title I attach code:
Forms\Components\Select::make('customer_id')
->relationship('customer', 'name')
->afterStateUpdated(fn (string $operation, Forms\Set $set) => $operation === 'create' ? $set('requested_by', auth()->user()->id) : null)
->searchable()
->required()
->preload()
->live(),

Forms\Components\Select::make('requested_by')
->relationship('requestedBy', 'name', fn (Builder $query, Get $get) => $query->requestTicket($get('customer_id')))
->required(),
Forms\Components\Select::make('customer_id')
->relationship('customer', 'name')
->afterStateUpdated(fn (string $operation, Forms\Set $set) => $operation === 'create' ? $set('requested_by', auth()->user()->id) : null)
->searchable()
->required()
->preload()
->live(),

Forms\Components\Select::make('requested_by')
->relationship('requestedBy', 'name', fn (Builder $query, Get $get) => $query->requestTicket($get('customer_id')))
->required(),
2 Replies
Lara Zeus
Lara Zeus13mo ago
try add ->live() to requested_by select
H.Bilbao
H.BilbaoOP13mo ago
Thanks but not working, same problem
Want results from more Discord servers?
Add your server