how can i move $this->dispatchBrowserEvent function a static helper ? if i move $this->dispatchBrowserEvent to helper it says. "using this when not in object context" also self::dispatchBrowserEvent does not work, it only works if i use it directly in store function in livewire component
how can i move $this->dispatchBrowserEvent function a static helper ? if i move $this->dispatchBrowserEvent to helper it says. "using this when not in object context" also self::dispatchBrowserEvent does not work, it only works if i use it directly in store function in livewire component
You need to pass $this as parameter.
For example helper will looks like below
public function dispatch($content)
{
$content->dispatchBrowserEvent('success', ['message' => 'success']);
}
and then call in Livewire
dispatch($this);