TicketClosed.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 TicketClosed extends Notification implements ShouldQueue
  8. {
  9. use Queueable;
  10. private $title;
  11. private $url;
  12. private $reason;
  13. private $is_user;
  14. public function __construct($id, $title, $url, $reason, $is_user = null)
  15. {
  16. $this->id = $id;
  17. $this->title = $title;
  18. $this->url = $url;
  19. $this->reason = $reason;
  20. $this->is_user = $is_user;
  21. }
  22. public function via($notifiable)
  23. {
  24. return $this->is_user ? ['mail'] : sysConfig('ticket_closed_notification');
  25. }
  26. public function toMail($notifiable)
  27. {
  28. return "";
  29. // return (new MailMessage)
  30. // ->subject(trans('close_ticket', ['id' => $this->id, 'title' => $this->title]))
  31. // ->line($this->reason)
  32. // ->action(trans('notification.view_ticket'), $this->url)
  33. // ->line(__('If your problem has not been solved, Feel free to open other one.'));
  34. }
  35. public function toCustom($notifiable)
  36. {
  37. return [
  38. 'title' => trans('close_ticket', ['id' => $this->id, 'title' => $this->title]),
  39. 'content' => $this->reason,
  40. ];
  41. }
  42. }