Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

herman_onfly's avatar

Trying to dispacth events inside filament 3 form

I'm trying dispatch this event inside my form, but the event are not being dispatched, i'm doing something wrong?

public function setHotelInfo($lunaId, Set $set): void
{
    try {
        $hotelLuna = new HotelLuna();
        $hotels    = $hotelLuna->info($lunaId)['hotels'];

        if ($hotels[0]['id'] == 1) {
            throw new \Exception('deu ruim', 500);
        }

        //do some stuff

    } catch (\Exception | \Throwable $e) {
        $this->dispatch(
            'openModal',
            title: 'user.errors.duplicated_collaborator',
            description:'user.messages.duplicate_collaborator',
            status:ExceptionLevelsEnum::WARNING->getLabel(),
            actionCancel:['action' => 'redirectTo', 'label' => 'common.actions.cancel', 'urlRedirect' => 'App\Filament\Resources\UserResource\Pages\ListUsers'],
            actionContinue:['action' => 'close', 'label' => 'common.actions.edit_data']
        );
    }
}
0 likes
5 replies
Sinnbeck's avatar

Sorry but we cannot see screenshots located on your computer. Can you share the code?

Merklin's avatar

@herman_onfly And how are you catching this notification on the frontend? We need the blade file also to see what is going on.

1 like
herman_onfly's avatar

@Merklin Thats my notification code

jaseofspades88's avatar

Seldom do people ask themselves.. 'Why am I trying to do this? What do I hope to achieve?'.

What's the problem you're trying to solve?

Please or to participate in this conversation.