If we would like to not have the event handled immediately, but rather, put into the queue, we can add –queued to the create command as follows:

$ php artisan handler:eventdateReservedEmail --event=dateWasReserved --queued
    <?php namespace MyCompanyHandlersEvents;
    
    use MyCompanyEventsdateWasReserved;
    
    use IlluminateQueueInteractsWithQueue;
    use IlluminateContractsQueueShouldBeQueued;
    
    class RoomReservedEvent implements ShouldBeQueued {
    
    use InteractsWithQueue;
    
    public function __construct()
    {
        //
    }
    
    use IlluminateContractsQueueShouldBeQueued;

This interface tells Laravel that the event handler should be queued and not executed synchronously:

use IlluminateQueueInteractsWithQueue;

This trait allows us to interact with the queue to be able to do tasks, such as delete the job.

If we would like to not have the event handled immediately, but rather, put into the queue, we can add –queued to the create command as follows:

$ php artisan handler:eventdateReservedEmail --event=dateWasReserved --queued
    <?php namespace MyCompanyHandlersEvents;
    
    use MyCompanyEventsdateWasReserved;
    
    use IlluminateQueueInteractsWithQueue;
    use IlluminateContractsQueueShouldBeQueued;
    
    class RoomReservedEvent implements ShouldBeQueued {
    
    use InteractsWithQueue;
    
    public function __construct()
    {
        //
    }
    
    use IlluminateContractsQueueShouldBeQueued;

This interface tells Laravel that the event handler should be queued and not executed synchronously:

use IlluminateQueueInteractsWithQueue;

This trait allows us to interact with the queue to be able to do tasks, such as delete the job.

Advertisements