Files
minicrm/app/Notifications/TicketClosed.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

47 lines
1.4 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\Feedback;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class TicketClosed extends Notification
{
use Queueable;
public function __construct(
public Feedback $feedback,
public User $actor,
) {}
public function via(object $notifiable): array
{
return ['database', 'mail'];
}
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject(__('feedback.notif_ticket_closed_subject', ['id' => $this->feedback->id]))
->line(__('feedback.notif_ticket_closed_ticket', ['title' => $this->feedback->title]))
->line(__('feedback.notif_ticket_closed_by', ['name' => $this->actor->name]))
->action(__('feedback.notif_view_ticket'), url('/admin/feedbacks/' . $this->feedback->id . '/edit'));
}
public function toDatabase(object $notifiable): array
{
return [
'message' => __('feedback.notif_ticket_closed_message', [
'id' => $this->feedback->id,
'title' => $this->feedback->title,
'actor' => $this->actor->name,
]),
'feedback_id' => $this->feedback->id,
'actor_name' => $this->actor->name,
];
}
}