Files
portal-api/app/Mail/TicketCreated.php
2026-07-14 17:03:38 +07:00

47 lines
1.3 KiB
PHP

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class TicketCreated extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
public function __construct(
public readonly mixed $ticket,
public readonly mixed $customer,
) {}
public function envelope(): Envelope
{
return new Envelope(
subject: "[#{$this->ticket->ticket_num}] Yêu cầu hỗ trợ của bạn đã được tiếp nhận",
);
}
public function content(): Content
{
return new Content(
view: 'emails.customer.ticket-created',
with: [
'fullName' => trim("{$this->customer->firstname} {$this->customer->lastname}") ?: 'Quý khách',
'ticketNum' => $this->ticket->ticket_num,
'subject' => $this->ticket->subject,
'room' => $this->ticket->room,
'ticketUrl' => rtrim(config('app.frontend_url', ''), '/') . '/tickets/' . $this->ticket->ticket_num,
],
);
}
public function attachments(): array
{
return [];
}
}