Answer Posted / surbhi
Events and Listeners serve a great way to decouple a web application, since one event can have multiple listeners which are independent of each other.
The events folder created by the artisan command includes the following two files
1. : event.php
2. :SomeEvent.php.
Event.php
<?php
namespace AppEvents;
abstract class Event{
//
}
As mentioned above, event.php includes the basic definition of class Event and calls for namespace AppEvents. Please note that the user defined or custom events are created in this file.
SomeEvent.php
For example, if we need to initialize order variable in the constructor for registering an event, we can do it in the following way -
public function __construct(Order $order)
{
$this->order = $order;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
why we use Laravel - Session ?
How to check column is exists or not in a table using laravel?
Explain some features of laravel?
What is laravel contract?
List some official packages provided by laravel?
How to use session in laravel?
What is design pattern in laravel?
Can you exclude uris from csrf protection in laravel? Explain
Which template engine is used by laravel?
How to generate a controller with resources in laravel?
What is Basic Response in Laravel ?
Explain, how to get current environment in laravel 5?
What is the use of laravel framework?
How can we create a record in laravel using eloquent?
How to assign multiple middleware to laravel route ?