be-park / eventer
Improve laravel listener and register event in database making them restorable
Installs: 12 926
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
README
- This package improve the way laravel manage his listener to be able to listen on parent class of the event
- This package allow storing the event in the database in order to make them restorable
Installation
Add an Extends from Bepark\Eventer\EventServiceProvider
to the event provider class App\Provider\EventServiceProvider
With just this installation the event will be saved in your database.
You can also publish the config file php artisan vendor:publish --provider="Bepark\Eventer\AppServiceProvider"
. You'll be able to set listen_on_eloquent to also store all eloquent event generated by Laravel
Listen on parent class
You can listen on the parent class of the triggered event by using the EventHelper. Check the StorableEventListener to see how it works.
listenWithChildren()
will start listening on all event and will call the listener when it match.
Call it in the subscribe() method of your listener
EventHelper::listenWithChildren(Dispatcher $event, <ParentClass>, 'ListenerClass@method');