Explain Events and Listeners ?
Answer / 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 |
Do you know what is php artisan. List out some artisan commands?
Name databases supported by laravel.
How to generate it on homestead?
What are the difference between soft delete & delete in laravel?
How to use delete statement in laravel?
What is reverse path multicasting?
What is Laravel - File Uploading ?
How to get user’s ip address in laravel?
Explain the concept of events in laravel.
Explain the service container?
How to Sharing Data with all Views ?
What does valet park and link command do?