filament-clear-cache icon indicating copy to clipboard operation
filament-clear-cache copied to clipboard

[Question] - Dispatch Event

Open davideprevosto opened this issue 1 year ago • 3 comments

Related to:

To increment the button count call Livewire event clearCacheIncrement.

// Livewire v2
$this->emit('clearCacheIncrement');

// Livewire v3
$this->dispatch('clearCacheIncrement')->to(\CmsMulti\FilamentClearCache\Http\Livewire\ClearCache::class);

From where it needs to dispatch the event? I am sorry, I haven't got it.

Thank you

davideprevosto avatar Oct 27 '24 10:10 davideprevosto

Depends where you wanted to increment number e.g after a resource has been deleted, but it could be anywhere that Livewire is used.

We use it after most Filament actions using configurable to save littering the code base Screenshot 2024-10-28 at 17 51 58

The service class Screenshot 2024-10-28 at 17 52 37

cms-multi avatar Oct 28 '24 17:10 cms-multi

I've completely misunderstood the scope of that counter. Sorry about that. I will try to better understand how and when I can use the dispatch.

davideprevosto avatar Oct 28 '24 18:10 davideprevosto

@cms-multi Honestly, I didn't understand what's the purpose of this counter. Thanks

eleftrik avatar Oct 28 '24 21:10 eleftrik