TicketReplied.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 TicketReplied extends Notification implements ShouldQueue
  8. {
  9. use Queueable;
  10. private $title;
  11. private $content;
  12. private $url;
  13. private $is_user;
  14. public function __construct($title, $content, $url, $is_user = null)
  15. {
  16. $this->title = $title;
  17. $this->content = $content;
  18. $this->url = $url;
  19. $this->is_user = $is_user;
  20. }
  21. public function via($notifiable)
  22. {
  23. return $this->is_user ? ['mail'] : sysConfig('ticket_replied_notification');
  24. }
  25. public function toMail($notifiable)
  26. {
  27. return "";
  28. // return (new MailMessage)
  29. // ->subject(trans('notification.reply_ticket', ['title' => $this->title]))
  30. // ->line(trans('notification.ticket_content'))
  31. // ->line(strip_tags($this->content))
  32. // ->action(trans('notification.view_ticket'), $this->url);
  33. }
  34. public function toCustom($notifiable)
  35. {
  36. return [
  37. 'title' => trans('notification.reply_ticket', ['title' => $this->title]),
  38. 'content' => trans('notification.ticket_content').strip_tags($this->content),
  39. ];
  40. }
  41. }