Files
minicrm/app/Notifications/TicketTransferred.php
phuongtc 8c6b71cb8a
Some checks failed
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
Tests / PHP 8.5 (push) Has been cancelled
feat: add i18n support for Vietnamese and English
2026-05-04 10:40:39 +00:00

52 lines
1.7 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\Feedback;
use App\Models\TicketTransferLog;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class TicketTransferred extends Notification
{
use Queueable;
public function __construct(
public Feedback $feedback,
public TicketTransferLog $transferLog,
public User $sender,
) {}
public function via(object $notifiable): array
{
return ['database', 'mail'];
}
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject(__('feedback.notif_ticket_transferred_subject', ['id' => $this->feedback->id]))
->line(__('feedback.notif_ticket_closed_ticket', ['title' => $this->feedback->title]))
->line(__('feedback.notif_ticket_transferred_by', ['name' => $this->sender->name]))
->line(__('feedback.notif_ticket_transferred_reason', ['reason' => $this->transferLog->reason]))
->action(__('feedback.notif_view_ticket'), url('/admin/feedbacks/' . $this->feedback->id . '/edit'));
}
public function toDatabase(object $notifiable): array
{
return [
'message' => __('feedback.notif_ticket_transferred_message', [
'id' => $this->feedback->id,
'title' => $this->feedback->title,
'sender' => $this->sender->name,
]),
'feedback_id' => $this->feedback->id,
'sender_name' => $this->sender->name,
'reason' => $this->transferLog->reason,
'to_department_id' => $this->transferLog->to_department_id,
];
}
}