TicketNotification.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace App\Notifications;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Notifications\Notification;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use Illuminate\Notifications\Messages\MailMessage;
  7. class TicketNotification extends Notification
  8. {
  9. use Queueable;
  10. protected $ticket,$action_type, $addedBy;
  11. /**
  12. * Create a new notification instance.
  13. *
  14. * @return void
  15. */
  16. public function __construct($ticket,$action_type, $addedBy, $comment=NULL)
  17. {
  18. $this->ticket = $ticket;
  19. $this->action_type = $action_type;
  20. $this->addedBy = $addedBy;
  21. $this->comment = $comment;
  22. //$this->assign_person = $assign_person;
  23. }
  24. /**
  25. * Get the notification's delivery channels.
  26. *
  27. * @param mixed $notifiable
  28. * @return array
  29. */
  30. public function via($notifiable)
  31. {
  32. return ['database'];
  33. }
  34. /**
  35. * Get the mail representation of the notification.
  36. *
  37. * @param mixed $notifiable
  38. * @return \Illuminate\Notifications\Messages\MailMessage
  39. */
  40. public function toDatabase($notifiable)
  41. {
  42. return [
  43. 'ticket' => $this->ticket,// ticket information
  44. 'action_type' => $this->action_type, // creator
  45. 'addedBy' => $this->addedBy, // creator
  46. 'comment' => $this->comment, // creator
  47. 'user' => $notifiable // send
  48. ];
  49. }
  50. /**
  51. * Get the array representation of the notification.
  52. *
  53. * @param mixed $notifiable
  54. * @return array
  55. */
  56. public function toArray($notifiable)
  57. {
  58. return [
  59. //
  60. ];
  61. }
  62. }