|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
|
-use App\Models\Ticket;
|
|
|
+use App\Models\TicketReply;
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
@@ -13,13 +13,13 @@ class TicketReplied extends Notification implements ShouldQueue
|
|
|
{
|
|
|
use Queueable;
|
|
|
|
|
|
- private $ticket;
|
|
|
+ private $reply;
|
|
|
private $url;
|
|
|
private $is_user;
|
|
|
|
|
|
- public function __construct(Ticket $ticket, $url, $is_user = false)
|
|
|
+ public function __construct($reply, $url, $is_user = false)
|
|
|
{
|
|
|
- $this->ticket = $ticket;
|
|
|
+ $this->reply = $reply;
|
|
|
$this->url = $url;
|
|
|
$this->is_user = $is_user;
|
|
|
}
|
|
@@ -32,17 +32,17 @@ class TicketReplied extends Notification implements ShouldQueue
|
|
|
public function toMail($notifiable)
|
|
|
{
|
|
|
return (new MailMessage)
|
|
|
- ->subject(trans('notification.reply_ticket', ['title' => $this->ticket->title]))
|
|
|
+ ->subject(trans('notification.reply_ticket', ['title' => $this->reply->ticket->title]))
|
|
|
->line(trans('notification.ticket_content'))
|
|
|
- ->line(strip_tags($this->ticket->content))
|
|
|
+ ->line(strip_tags($this->reply->content))
|
|
|
->action(trans('notification.view_ticket'), $this->url);
|
|
|
}
|
|
|
|
|
|
public function toCustom($notifiable)
|
|
|
{
|
|
|
return [
|
|
|
- 'title' => trans('notification.reply_ticket', ['title' => $this->ticket->title]),
|
|
|
- 'content' => trans('notification.ticket_content').strip_tags($this->ticket->content),
|
|
|
+ 'title' => trans('notification.reply_ticket', ['title' => $this->reply->ticket->title]),
|
|
|
+ 'content' => trans('notification.ticket_content').strip_tags($this->reply->content),
|
|
|
];
|
|
|
}
|
|
|
|
|
@@ -50,12 +50,12 @@ class TicketReplied extends Notification implements ShouldQueue
|
|
|
{
|
|
|
return TelegramMessage::create()
|
|
|
->token(sysConfig('telegram_token'))
|
|
|
- ->content($this->markdownMessage($this->ticket))
|
|
|
+ ->content($this->markdownMessage($this->reply))
|
|
|
->button(trans('notification.view_ticket'), $this->url);
|
|
|
}
|
|
|
|
|
|
- private function markdownMessage($ticket)
|
|
|
+ private function markdownMessage(TicketReply $reply)
|
|
|
{
|
|
|
- return "📮工单回复提醒 #{$ticket->id}\n———————————————\n主题:\n`{$ticket->title}`\n内容:\n`{$ticket->content}`";
|
|
|
+ return "📮工单回复提醒 #{$reply->ticket->id}\n———————————————\n主题:\n`{$reply->ticket->title}`\n内容:\n`{$reply->content}`";
|
|
|
}
|
|
|
}
|