DynamicNotification.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace App\Notifications;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Notifications\Notification;
  5. class DynamicNotification extends Notification
  6. {
  7. use Queueable;
  8. /**
  9. * @var array
  10. */
  11. private $via;
  12. /**
  13. * @var array
  14. */
  15. private $database;
  16. /**
  17. * @var MailMessage
  18. */
  19. private $mail;
  20. /**
  21. * Create a new notification instance.
  22. *
  23. * @param array $via
  24. * @param array $database
  25. * @param MailMessage $mail
  26. */
  27. public function __construct($via, $database, $mail)
  28. {
  29. $this->via = $via;
  30. $this->database = $database;
  31. $this->mail = $mail;
  32. }
  33. /**
  34. * Get the notification's delivery channels.
  35. *
  36. * @param mixed $notifiable
  37. * @return array
  38. */
  39. public function via()
  40. {
  41. return $this->via;
  42. }
  43. public function toMail()
  44. {
  45. return $this->mail;
  46. }
  47. /**
  48. * Get the array representation of the notification.
  49. *
  50. * @param mixed $notifiable
  51. * @return array
  52. */
  53. public function toArray()
  54. {
  55. return $this->database;
  56. }
  57. }