update email template
This commit is contained in:
+22
-10
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Mail\Concerns\RequiresDbTemplate;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
@@ -11,7 +12,7 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TicketCreated extends Mailable implements ShouldQueue
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
use Queueable, SerializesModels, RequiresDbTemplate;
|
||||
|
||||
public function __construct(
|
||||
public readonly mixed $ticket,
|
||||
@@ -21,21 +22,14 @@ class TicketCreated extends Mailable implements ShouldQueue
|
||||
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",
|
||||
subject: $this->renderFromTemplate('ticket_created', $this->vars())['subject'],
|
||||
);
|
||||
}
|
||||
|
||||
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,
|
||||
],
|
||||
htmlString: $this->renderFromTemplate('ticket_created', $this->vars())['html'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,4 +37,22 @@ class TicketCreated extends Mailable implements ShouldQueue
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function vars(): 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',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user