55 lines
1.5 KiB
PHP
55 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Mail\Customer;
|
|
|
|
use App\Mail\Concerns\RequiresDbTemplate;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class VmRebuildFailed extends Mailable
|
|
{
|
|
use Queueable, SerializesModels, RequiresDbTemplate;
|
|
|
|
public array $data;
|
|
|
|
public function __construct(array $data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
return new Envelope(
|
|
subject: $this->renderFromTemplate('vm_rebuild_failed', $this->vars())['subject'],
|
|
);
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
htmlString: $this->renderFromTemplate('vm_rebuild_failed', $this->vars())['html'],
|
|
);
|
|
}
|
|
|
|
public function attachments(): array
|
|
{
|
|
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'),
|
|
];
|
|
}
|
|
}
|