Files
portal-api/app/Mail/TicketCreated.php
T
2026-10-05 09:30:24 +07:00

46 lines
1.5 KiB
PHP

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\SerializesModels;
class TicketCreated extends TemplateMailable implements ShouldQueue
{
use Queueable, SerializesModels;
public function __construct(
public readonly mixed $ticket,
public readonly mixed $customer,
) {}
public function attachments(): array
{
return [];
}
protected function scenario(): string
{
return 'ticket_created';
}
protected function variables(): array
{
$room = $this->ticket->room ?? null;
return [
'full_name' => trim("{$this->customer->firstname} {$this->customer->lastname}") ?: 'Quý khách',
'ticket_num' => $this->ticket->ticket_num,
'subject' => $this->ticket->subject,
'room_row' => $room
? '<tr><td style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #666666; padding: 4px 0;" valign="top">Phòng ban:</td><td style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #000000; padding: 4px 0;" valign="top">' . $room . '</td></tr>'
: '',
'ticket_url' => rtrim(config('app.frontend_url', ''), '/') . '/tickets/' . $this->ticket->ticket_num,
'app_name' => config('app.name', 'Thế Giới Số'),
'support_email' => 'support@tgs.com.vn',
'support_phone' => '(028) 7309. 7379',
];
}
}