Search

Laravel Artisan Generator Command: The make:event Command

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.

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.