You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.9 KiB

  1. <?php
  2. namespace App\Notifications;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Contracts\Queue\ShouldQueue;
  5. use Illuminate\Notifications\Messages\MailMessage;
  6. use Illuminate\Notifications\Notification;
  7. class MailNotification extends Notification //implements ShouldQueue
  8. {
  9. use Queueable;
  10. public $message;
  11. /**
  12. * The name of the queue connection to use when queueing the notification.
  13. *
  14. * @var string
  15. */
  16. // public $connection = 'redis';
  17. /**
  18. * If your queue connection's after_commit configuration option is set to true,
  19. * indicate that a particular queued listener should be dispatched after all database transactions closed
  20. *
  21. * @var boolean
  22. */
  23. // public $afterCommit = true;
  24. /**
  25. * Determine which queues should be used for notification.
  26. *
  27. * @return string
  28. */
  29. // public $queue = 'mail-queue';
  30. /**
  31. * Create a new notification instance.
  32. *
  33. * @return void
  34. */
  35. public function __construct($message)
  36. {
  37. $this->message = $message;
  38. }
  39. /**
  40. * Get the notification's delivery channels.
  41. *
  42. * @param mixed $notifiable
  43. * @return array
  44. */
  45. public function via($notifiable)
  46. {
  47. return ['mail'];
  48. }
  49. /**
  50. * Get the mail representation of the notification.
  51. *
  52. * @param mixed $notifiable
  53. * @return \Illuminate\Notifications\Messages\MailMessage
  54. */
  55. public function toMail($notifiable)
  56. {
  57. return (new MailMessage)
  58. ->line(__('notification.'.$this->message))
  59. ->action('Notification Action', url('/'))
  60. ->line('Thank you for using our application!');
  61. }
  62. /**
  63. * Get the array representation of the notification.
  64. *
  65. * @param mixed $notifiable
  66. * @return array
  67. */
  68. public function toArray($notifiable)
  69. {
  70. return [
  71. //
  72. ];
  73. }
  74. }