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

zikrimuhammad09's avatar

Event Listeners Not Working Livewire 3

Hello, I’m working with two Livewire components in Laravel, where I want the parent component (FakturBarang) to listen for an event dispatched from the child component (TambahFakturBarang) after successfully adding data.

I have tried using #[On('updateFakturBarang')] in the parent component and dispatch('updateFakturBarang') in the child component, but the event in the parent component is not being triggered when I dispatch it.

Here’s the code in the parent component (FakturBarang):

and this in child component (TambahFakturBarang):

In the blade faktur-barang.blade.php:

and tambah-faktur-barang.blade.php:

Thankyou

1 like
2 replies
Nakov's avatar

I am curious is just that event not working? What about the closeModal and the toast events? Are those being handled from somewhere else?

Also have you tried to reverse the order, like this:

$this->dispatch('updateFakturBarang');

$this->dispatch('toast', [
    'title' => 'Berhasil!',
    'message' => 'Faktur barang berhasil ditambahkan.',
    'type' => 'success',
]);


$this->dispatch('closeModal');

so you can be sure that is not your toast handler killing everything.

1 like

Please or to participate in this conversation.