Files
portal-api/app/Mail/Customer/VMCreationFailed.php
T
2026-09-09 16:56:22 +07:00

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 VMCreationFailed 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_creation_failed', $this->vars())['subject'],
);
}
public function content(): Content
{
return new Content(
htmlString: $this->renderFromTemplate('vm_creation_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',
'order_num' => $this->data['order_num'] ?? 'N/A',
'product_name' => $this->data['product_name'] ?? 'Sản phẩm',
'invoice_url' => rtrim(env('FRONTEND_URL', config('app.url')), '/') . '/hoa-don/' . ($this->data['order_id'] ?? ''),
'support_email' => config('mail.support_email', 'support@example.com'),
'support_phone' => config('mail.support_phone', '1900-xxxx'),
];
}
}