NotificationSendTweet.php 925 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Listeners;
  3. use App\Events\SendTweet;
  4. use Illuminate\Contracts\Queue\ShouldQueue;
  5. use Illuminate\Queue\InteractsWithQueue;
  6. use Illuminate\Support\Facades\Log;
  7. class NotificationSendTweet
  8. {
  9. /**
  10. * Create the event listener.
  11. *
  12. * @return void
  13. */
  14. public function __construct()
  15. {
  16. //
  17. }
  18. /**
  19. * Handle the event.
  20. *
  21. * @param SendTweet $event
  22. * @return void
  23. */
  24. public function handle(SendTweet $event)
  25. {
  26. $data = array('name' => $event -> user-> name,
  27. 'email' => $event -> user -> email,
  28. 'body' => 'Thank you for joining Twittor! i hope you will enjoy the loneliness!!');
  29. Log::channel('stack')->info('email', $data, function($message) use ($data) {
  30. $message -> to($data['email'])->subject('Thank you letter');
  31. $message -> from('noreply@artisanweb.net');
  32. });
  33. }
  34. }