I'm trying to transform the following piece of code into a Facade.
But I don't know how to call $this
in the facade. I want to do this without using $this
or passing it as a parameter. Can I somehow dependency inject it?
The following piece of code is inside a livewire component which will dispatch event to show a toast by a JS listener.
//turn this
$this->dispatchBrowserEvent('showToast', ['name'=>'success','title' => 'Updated','message'=>'Your data is saved']);
//into this
$toast::success('Updated','Your data is saved');
How can I simplify this code?