Search code examples
laravellaravel-livewire

Livewire V3 Dispatch To Model in Sub Folder


I'm working with Livewire V3. I use the $dispatch('show-post-modal') to dispatch an even I would live to use the $dispatchTo('customers','show-customer-modal') but my structure is not all livewire element in the default folder.

php artisan make:livewire pages.customers.modal Pages/Customers/Modal I would love to dispatchTo('Pages/Customers/Modal','show-customer-modal')

Any idea the proper way to do this.


Solution

  • You almost had it. It uses the same dot-notation as views and such in Laravel.

    wire:click="$dispatchTo('pages.customers.modal','show-customer-modal')"