update email template
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Mail\Customer;
|
||||
|
||||
use App\Mail\Concerns\RequiresDbTemplate;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
@@ -11,7 +11,7 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class VmRebuildFailed extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
use Queueable, SerializesModels, RequiresDbTemplate;
|
||||
|
||||
public array $data;
|
||||
|
||||
@@ -23,22 +23,14 @@ class VmRebuildFailed extends Mailable
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Thông báo: Cài lại hệ điều hành thất bại - ' . ($this->data['vm_name'] ?? 'VPS'),
|
||||
subject: $this->renderFromTemplate('vm_rebuild_failed', $this->vars())['subject'],
|
||||
);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'emails.customer.vm-rebuild-failed',
|
||||
with: [
|
||||
'customerName' => $this->data['customer_name'] ?? 'Khách hàng',
|
||||
'vmName' => $this->data['vm_name'] ?? 'N/A',
|
||||
'ip' => $this->data['ip'] ?? 'N/A',
|
||||
'supportEmail' => config('mail.support_email', 'support@example.com'),
|
||||
'supportPhone' => config('mail.support_phone', '1900-xxxx'),
|
||||
'serviceUrl' => rtrim((string) env('FRONTEND_URL', config('app.url')), '/') . '/dich-vu',
|
||||
],
|
||||
htmlString: $this->renderFromTemplate('vm_rebuild_failed', $this->vars())['html'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -46,4 +38,17 @@ class VmRebuildFailed extends Mailable
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function vars(): array
|
||||
{
|
||||
return [
|
||||
'app_name' => config('app.name', 'Thế Giới Số'),
|
||||
'full_name' => $this->data['customer_name'] ?? 'Khách hàng',
|
||||
'vm_name' => $this->data['vm_name'] ?? 'N/A',
|
||||
'ip' => $this->data['ip'] ?? 'N/A',
|
||||
'service_url' => rtrim((string) env('FRONTEND_URL', config('app.url')), '/') . '/dich-vu',
|
||||
'support_email' => config('mail.support_email', 'support@example.com'),
|
||||
'support_phone' => config('mail.support_phone', '1900-xxxx'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user