Laravel 5: Events – Listener

Scheduler: Events – Listener


Listener – Usage.

When you register event using Artisan command, e.g.:

… you get this template:

Method

… will be your worker here.

This is where you are going to respond to Event, that activated this Listener.
This is, where you will gather your army of tools to get the job done.


Your event listeners may also type-hint any dependencies they need on their constructors.
All event listeners are resolved via the Laravel service container, so dependencies will be injected automatically.

In other words, you will be able to do this: