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

39 lines
1.2 KiB
PHP

<?php
namespace App\Mail\Admin;
use App\Mail\TemplateMailable;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\SerializesModels;
class TicketAdminNotification extends TemplateMailable implements ShouldQueue
{
use Queueable, SerializesModels;
public function __construct(
public readonly mixed $ticket,
public readonly mixed $customer,
) {}
protected function scenario(): string
{
return 'admin_ticket_notification';
}
protected function variables(): array
{
$description = strip_tags($this->ticket->description ?? '');
return [
'ticket_num' => $this->ticket->ticket_num,
'subject_text' => $this->ticket->subject,
'room' => $this->ticket->room ?? 'N/A',
'customer_name' => trim($this->customer->firstname . ' ' . $this->customer->lastname) ?: 'N/A',
'customer_email'=> $this->customer->email,
'description' => mb_substr($description, 0, 500) . (mb_strlen($description) > 500 ? '…' : ''),
'ticket_url' => config('app.frontend_url') . '/tickets/' . $this->ticket->ticket_num,
];
}
}