Guest User

Untitled

a guest
Jan 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <?php
  2.  
  3. namespace AppListeners;
  4.  
  5. use AppEventsNewMail;
  6. use IlluminateQueueInteractsWithQueue;
  7. use IlluminateContractsQueueShouldQueue;
  8. use AppJobsSendEmail;
  9. use CarbonCarbon;
  10. class NewMailListener implements ShouldQueue
  11. {
  12. /**
  13. * Create the event listener.
  14. *
  15. * @return void
  16. */
  17. public function __construct()
  18. {
  19. //
  20. }
  21.  
  22. /**
  23. * Handle the event.
  24. *
  25. * @param NewMail $event
  26. * @return void
  27. */
  28. public function handle(NewMail $event)
  29. {
  30. $addressee = $event->user->name;
  31. $address = $event->user->email;
  32. $type = "NewMail";
  33. $job = (new SendEmail($type,$addressee,$address))->delay(Carbon::now()->addMinutes(10));
  34. dispatch($job);
  35. }
  36. }
  37.  
  38. <?php
  39.  
  40. namespace IlluminateContractsQueue;
  41.  
  42. interface ShouldQueue
  43. {
  44. //
  45. }
Add Comment
Please, Sign In to add comment