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;
    }),
Was this page helpful?