Laravel - Events - Registering Events And Listeners
The App\Providers\EventServiceProvider
included with your Laravel application provides a convenient place to register all of your application's event listeners. The listen
property contains an array of all events (keys) and their listeners (values). You may add as many events to this array as your application requires. For example, let's add an OrderShipped
event:
use App\Events\OrderShipped;
use App\Listeners\SendShipmentNotification;
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
OrderShipped::class => [
SendShipmentNotification::class,
],
];
The event:list
command may be used to display a list of all events and listeners registered by your application.