© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
10 replies
Mark Chaney

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
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;
    }),
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Set user_id on new record
FilamentFFilament / ❓┊help
2y ago
Success Notification for CreateOptionAction with injected created Record
FilamentFFilament / ❓┊help
2y ago
Use ID on newly created Model from ->createOptionAction
FilamentFFilament / ❓┊help
15mo ago
CreateOptionAction type error
FilamentFFilament / ❓┊help
3y ago