SignSuccessMessage.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace App\Notifications;
  3. use App\Events\SuccessSignMessageEvent;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use Illuminate\Notifications\Messages\MailMessage;
  7. use Illuminate\Notifications\Notification;
  8. class SignSuccessMessage extends Notification implements ShouldQueue
  9. {
  10. use Queueable;
  11. /**
  12. * Create a new notification instance.
  13. *
  14. * @return void
  15. */
  16. public $data;
  17. public function __construct($data)
  18. {
  19. $this->data=$data;
  20. }
  21. /**
  22. * Get the notification's delivery channels.
  23. *
  24. * @param mixed $notifiable
  25. * @return array
  26. */
  27. public function via($notifiable)
  28. {
  29. return ['message'];
  30. }
  31. /**
  32. * Get the mail representation of the notification.
  33. *
  34. * @param mixed $notifiable
  35. * @return \Illuminate\Notifications\Messages\MailMessage
  36. */
  37. public function toMail($notifiable)
  38. {
  39. return (new MailMessage)
  40. ->line('The introduction to the notification.')
  41. ->action('Notification Action', url('/'))
  42. ->line('Thank you for using our application!');
  43. }
  44. /**
  45. * Get the array representation of the notification.
  46. *
  47. * @param mixed $notifiable
  48. * @return array
  49. */
  50. public function toArray($notifiable)
  51. {
  52. return [
  53. //
  54. ];
  55. }
  56. public function toMessage(SignSuccessMessage $notifiable){
  57. return (new SuccessSignMessageEvent($notifiable->data));
  58. }
  59. }