© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
4 replies
Rolland

how to trigger notification on a custom bulkaction?

Tables\Actions\BulkAction::make('toggleStatus')
    ->label('Toggle Status')
    ->icon('heroicon-o-arrow-path')
    ->requiresConfirmation()
    ->action(function (Collection $records) {
        $records->each(function (User $user) {
            $user->update(['is_active' => !$user->is_active]);
        });
    })
    ->deselectRecordsAfterCompletion()
    ->successNotification(
        Notification::make()
            ->success()
            ->title('User status updated')
            ->body('The selected users\' statuses have been toggled.')
    ),
Tables\Actions\BulkAction::make('toggleStatus')
    ->label('Toggle Status')
    ->icon('heroicon-o-arrow-path')
    ->requiresConfirmation()
    ->action(function (Collection $records) {
        $records->each(function (User $user) {
            $user->update(['is_active' => !$user->is_active]);
        });
    })
    ->deselectRecordsAfterCompletion()
    ->successNotification(
        Notification::make()
            ->success()
            ->title('User status updated')
            ->body('The selected users\' statuses have been toggled.')
    ),
Solution
you can just move notification to action like this
->action(function (Collection $records) {
        $records->each(function (User $user) {
            $user->update(['is_active' => !$user->is_active]);
        });

     Notification::make()
            ->success()
            ->title('User status updated')
            ->body('The selected users\' statuses have been toggled.')
            ->send();
    })
->action(function (Collection $records) {
        $records->each(function (User $user) {
            $user->update(['is_active' => !$user->is_active]);
        });

     Notification::make()
            ->success()
            ->title('User status updated')
            ->body('The selected users\' statuses have been toggled.')
            ->send();
    })
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

Bulkaction notification
FilamentFFilament / ❓┊help
12mo ago
Custom BulkAction
FilamentFFilament / ❓┊help
2y ago
How can broadcast a custom notification on specefic channel?
FilamentFFilament / ❓┊help
2y ago
How to run a BulkAction on selected to table records
FilamentFFilament / ❓┊help
2y ago