First , we need to create Event and to listen event, we also have to create listener.
To do this , laravel provides us several ways. The easiest way to create event and corresponding listener we can use this command
php artisan event:generate
'App\Events\DeleteBranchCourse' => [
            'App\Listeners\DeleteCourseConfirmation',
        ], 
Now we are ready to run our command
php artisan event:generate
class DeleteCourseConfirmation implements ShouldQueue(){
  use InteractsWithQueue; 
}
So to use queue , we have to use database as queue driver.
Now we will create a function hello in DeleteBranchCourse Event class and call this function from DeleteCourseConfirmation's handler function
public function handle(DeleteBranchCourse $event)
    {
        $this->attempts($event->hello());
    }
Now we have to fire our event from a controller's function
Event::fire(new DeleteBranchCourse($feeId));
 
 
 
 
 
 
 
 
 

0 comments:
Post a Comment