Short information about events & listeners
The main usage of the Events and Listeners pattern is that you can specify in the code that some event has just happened, and then there are Listener classes that automatically catch the Event and perform some action. You can attach one or multiple listener classes to one event.
In this way, you separate the code from the Controller to another layer, also helping the future developers who may want to expand functionality by listening to the same event.
An example may be the event "Registered User", which would have a couple of Listeners: one would send an email to the admin, another one would create some database records for that user, etc.
Read more in the official Laravel docs.
- app/Providers/EventServiceProvider.php
- app/Events/StoredAccount.php
- app/Providers/EventServiceProvider.php
- app/Factory/AccountFactory.php
- app/Events/Document/DocumentViewed.php
- app/Listeners/Document/MarkDocumentViewed.php
- app/Http/Controllers/Portal/Invoices.php
- app/Providers/EventServiceProvider.php
- app/Listeners/SendArticleApprovedNotification.php
- app/Providers/EventServiceProvider.php
- app/Events/ProjectAction.php
- app/Http/Controllers/ProjectsController.php
- app/Listeners/FailedLoginListener.php
- app/Models/Import.php
- /app/Listeners/Backend/UserCreated/UserCreatedProfileCreate.php
- app/Http/Controllers/Backend/UserController.php
- app/Events/Projects/Created.php
- app/Listeners/Projects/LogProjectCreationActivity.php
- app/Http/Controllers/CommentController.php
- app/Listeners/NotifyMentionedUsers.php
- app/Http/Controllers/App/PackageController.php
- app/Events/PackageCreated.php
- app/Listeners/SendNewPackageNotification.php
- app/Listeners/ResizeImage.php
- app/Providers/EventServiceProvider.php
- app/Http/Livewire/Profile/UpdateImage.php
- app/Providers/EventServiceProvider.php
- app/Listeners/UpdateCourseEvents.php
- app/Providers/EventServiceProvider.php
- app/Models/ExternalCourse.php
- app/Events/Photo/IncrementPhotoMonth.php
- app/Listeners/UpdateTags/ResetCompileString.php
- app/Listeners/UpdateTags/DecrementCity.php
- app/Events/UserVerified.php
- app/Listeners/SendNewUserNotification.php
Additional resources on events & listeners:
-
Povilas Korop | www.youtube.com
Published on
-
Povilas Korop | www.youtube.com
Published on
-
Povilas Korop | www.youtube.com
Published on
-
Kingsley Okpara | dev.to
Published on
-
Kingsley Okpara | dev.to
Published on