Add custom Select options to formFill

Add custom Select options to formFill I have a bulkAction form modal that should allow for the status field to be changed, but the "options" should be limited based on a transition table, which defines which status can transition into which "next" status. So the user cannot hop from one to all others. I have the array for the options added in the form->fill(), but I cannot for the life of me figure out, how to access these to put them into the ->options() of the Select in the form itself. So basically, where is the data that I put into the formFill?
Tables\Actions\BulkAction::make('status_update')
->label("Update Status")
->mountUsing(function (Form $form, Collection $records, $action) {
$current_status_id = $records->first()->status_id;
$statusTransitions = StatusTransition::with('toStatus')
->where('from_status_id', $current_status_id)
->get()
->mapWithKeys(function ($transition) {
return [$transition->to_status_id => $transition->toStatus->name];
})
->toArray();

$form->fill([
'current_status_id' => $current_status_id,
'statusTransitions' => $statusTransitions,
]);
})
->form([
Select::make('new_status_id')
->label('Status')
**->options('what_goes_here??')**
->required(),
])
->action(function (Collection $records, $data) {
}),
Tables\Actions\BulkAction::make('status_update')
->label("Update Status")
->mountUsing(function (Form $form, Collection $records, $action) {
$current_status_id = $records->first()->status_id;
$statusTransitions = StatusTransition::with('toStatus')
->where('from_status_id', $current_status_id)
->get()
->mapWithKeys(function ($transition) {
return [$transition->to_status_id => $transition->toStatus->name];
})
->toArray();

$form->fill([
'current_status_id' => $current_status_id,
'statusTransitions' => $statusTransitions,
]);
})
->form([
Select::make('new_status_id')
->label('Status')
**->options('what_goes_here??')**
->required(),
])
->action(function (Collection $records, $data) {
}),
Thanks in advance!
0 Replies
No replies yetBe the first to reply to this messageJoin