© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
ChrisB

Multiple Actions on Save

I'm new to Filament, and Laravel in general...sorry in advance if I've missed something elementary. I've got a long way on my own, but hit a brick wall on this one.

Resource setup (with relationship too, but unrelated for this question), and working perfectly for creating, deleting and editing.

At this point, my question relates to being in an existing record and making changes. When pressing save, I want to save the record + fire off a webhook to trigger a third party.

I've fired up Webhooks, and can a call it from a separate action button on my form. I just can't combine them!

The below code is located in my ''Edit Page' of the resource, and fires off my function to send the webhook. It doesn't save the record.

Anyone able to show me how I can include the save command in the same action?

    protected function getFormActions(): array
{
    return [
        $this->getSaveFormAction()
            ->label('Save and Trigger')
            ->submit(null)
            ->action(function (MyModel $new) {
                $result = $new->MyTriggerFunction('Some Data');
                  Notification::make()
                    ->title($result)
                    ->success()
                    ->send();
            }),
        $this->getCancelFormAction()
];
    protected function getFormActions(): array
{
    return [
        $this->getSaveFormAction()
            ->label('Save and Trigger')
            ->submit(null)
            ->action(function (MyModel $new) {
                $result = $new->MyTriggerFunction('Some Data');
                  Notification::make()
                    ->title($result)
                    ->success()
                    ->send();
            }),
        $this->getCancelFormAction()
];

Thanks in advance.
Solution
Here, lifecycle hooks should be the means of handling the thing.
In case of Edit Modal:
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/edit#lifecycle-hooks

In case of Edit Page:
https://filamentphp.com/docs/3.x/panels/resources/editing-records#lifecycle-hooks

Maybe like this?
    protected function afterSave(): void
    {
        $model = $this->getRecord();
        $result = $model->MyTriggerFunction('Some Data');
        Notification::make()
            ->title($result)
            ->success()
            ->send();
    }
    protected function afterSave(): void
    {
        $model = $this->getRecord();
        $result = $model->MyTriggerFunction('Some Data');
        Notification::make()
            ->title($result)
            ->success()
            ->send();
    }
Editing records - Panel Builder - Filament
Edit action - Actions - Filament
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Multiple add actions on repeater
FilamentFFilament / ❓┊help
2y ago
Multiple actions inline
FilamentFFilament / ❓┊help
2y ago
2 "save" actions on CreateResource with "mutateFormDataBeforeCreate"
FilamentFFilament / ❓┊help
2y ago
multiple selection save
FilamentFFilament / ❓┊help
2y ago