createOptionAction() and returning new record id

Ive typically used createOptionUsing() with success, but in order to reuse some logic, I need to use createOptionAction() to perform the creation. Now its creating the record just fine, but its not returning an id so that the Select field is now selected with that option. I mean i understand why its not to an extent, but figured i would get a second set of eyes on how to overcome it.
->createOptionForm(PropertyManager::getForm())
->createOptionAction(function ($action) {
$propertyManager = $action
->label('Create Property Manager')
->action(function ($arguments, $data, $form, $action, $livewire) {
return PropertyManager::createPropertyManagerLogic(arguments: $arguments, data: $data, form: $form, action: $action, livewire: $livewire);
})
->modalHeading('Create Property Manager')
->successNotificationTitle('Property Manager created successfully.')
->slideover();
ray($propertyManager);

return $propertyManager;
}),
->createOptionForm(PropertyManager::getForm())
->createOptionAction(function ($action) {
$propertyManager = $action
->label('Create Property Manager')
->action(function ($arguments, $data, $form, $action, $livewire) {
return PropertyManager::createPropertyManagerLogic(arguments: $arguments, data: $data, form: $form, action: $action, livewire: $livewire);
})
->modalHeading('Create Property Manager')
->successNotificationTitle('Property Manager created successfully.')
->slideover();
ray($propertyManager);

return $propertyManager;
}),
4 Replies
Mark Chaney
Mark ChaneyOP16mo ago
looks like i can just use $set('name_of_select') to do it. Figured there was more an automatic way, but this works too interesting though that when i do that, the afterStateUpdated on the Select doesnt appear to run like it does when i manually select something from it @Dan Harrin is this a bug that createOptionAction doesn’t return the id like Using does?
Dan Harrin
Dan Harrin16mo ago
no createOptionAction is used to customize the action instance short for modifyCreateOptionActionUsing()
Mark Chaney
Mark ChaneyOP16mo ago
I guess i more expected it to work like action() and using() on a CreateAction
Dan Harrin
Dan Harrin16mo ago
yeah well no using() is that
Want results from more Discord servers?
Add your server