FilamentF
Filament2y ago
Hugo

How to dispatch an event from a Notification Action

I've been trying to dispatch an event from a Notification Action but it's not working.

using ->dispatch or ->dispatchSelf seems to do nothing.
I've searched around and tried to use ->action() and dispatch using $livewire->dispatch() but action seems to not work on notification Actions.

How can I rly dispatch an event from a Notification action?
Notification::make()
  ->success()
  ->title('Portador criado com sucesso!')
  ->actions([                                   \Filament\Notifications\Actions\Action::make('view')
       ->label('Ver Portador')
    // ->url('/admin/business/clients/' .$client->id.'/edit?activeRelationManager=2',true)
       ->dispatchSelf('test-created')
                                    ])
  ->send();

Further down in my Resource, there's my method that is attempting to listen to the dispatch event but it never gets there.
 #[On('test-event')]
    public function test()
    {
        dd('here');
    }


Any Thoughts?
Was this page helpful?