December 7, 2016 —John Koster
The make:event
command is used to generate a new event class. The command requires a name
parameter to be supplied, which will be the name of the new class. The generated classes by default will extend the App\Events\Event
class (the actual namespace may be different depending on whether or not the applications root namespace has been changed).
The following example shows how to generate a new Event
class with the name OrderWasCanceled
:
1# Generate a new OrderWasCanceled event class.2php artisan make:event OrderWasCanceled
A class with the name OrderWasCanceled
would then appear in the app/Events/OrderWasCanceled.php
file.
This command does not update the $listen
mappings in the app/Providers/EventServiceProvider.php
service provider.
∎