© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•15mo ago•
1 reply
Shtick

Halt on beforeSave is preventing actions within notification to work.

In essence I'm trying to add a check to see if a model instance exists with a 'is_home_page' boolean flag is true prior to updating or saving. I'll provide the current WIP code below for a clearer picture but in essence the notification pops up with the actions however clicking on them don't work but using the url example from the docs works perfectly fine. If anyone has any insight I'd love to hear it. Cheers!
protected function beforeSave(): void
    {
        $existingPage = Page::where('is_active', true)->where('is_home_page', true)->first();
        if ($existingPage) {
            Notification::make()
                ->warning()
                ->title('Existing Active Home Page')
                ->body('There is a currently active home page set up. Would you like to make this page the new active home page and setting the old one to inactive?')
                ->persistent()
                ->actions([
                    Action::make('confirm')
                        ->button()
                        ->action(fn () => $this->emit('confirmAction')),
                    Action::make('cancel')
                        ->button()
                        ->action(fn () => $this->call('handleCancelAction')), // Use Livewire callback
                    Action::make('subscribe')
                        ->button()
                        ->url(route('home')),
                ])
                ->send();

            $this->halt();
        }
    }
protected function beforeSave(): void
    {
        $existingPage = Page::where('is_active', true)->where('is_home_page', true)->first();
        if ($existingPage) {
            Notification::make()
                ->warning()
                ->title('Existing Active Home Page')
                ->body('There is a currently active home page set up. Would you like to make this page the new active home page and setting the old one to inactive?')
                ->persistent()
                ->actions([
                    Action::make('confirm')
                        ->button()
                        ->action(fn () => $this->emit('confirmAction')),
                    Action::make('cancel')
                        ->button()
                        ->action(fn () => $this->call('handleCancelAction')), // Use Livewire callback
                    Action::make('subscribe')
                        ->button()
                        ->url(route('home')),
                ])
                ->send();

            $this->halt();
        }
    }
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

notification actions not work
FilamentFFilament / ❓┊help
3mo ago
Issue with halt() on beforeSave and a repeater with relationship
FilamentFFilament / ❓┊help
2y ago
Notification actions
FilamentFFilament / ❓┊help
3y ago
beforeSave()
FilamentFFilament / ❓┊help
3y ago