update email template

This commit is contained in:
baodev0
2026-09-09 16:56:22 +07:00
parent d3d9f76ba0
commit 2365ef72e9
210 changed files with 6335 additions and 4688 deletions
+18 -29
View File
@@ -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,55 +11,44 @@ use Illuminate\Queue\SerializesModels;
class VMCreationFailed extends Mailable
{
use Queueable, SerializesModels;
use Queueable, SerializesModels, RequiresDbTemplate;
public array $data;
/**
* Create a new message instance.
*/
public function __construct(array $data)
{
$this->data = $data;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: 'Thông báo: Không thể khởi tạo máy chủ ảo - Đơn hàng #' . ($this->data['order_num'] ?? 'N/A'),
subject: $this->renderFromTemplate('vm_creation_failed', $this->vars())['subject'],
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
view: 'emails.customer.vm-creation-failed',
with: [
'customerName' => $this->data['customer_name'] ?? 'Khách hàng',
'productName' => $this->data['product_name'] ?? 'Sản phẩm',
'orderId' => $this->data['order_id'] ?? 'N/A',
'orderNum' => $this->data['order_num'] ?? 'N/A',
'errorMessage' => $this->data['error_message'] ?? 'Lỗi không xác định',
'supportEmail' => config('mail.support_email', 'support@example.com'),
'supportPhone' => config('mail.support_phone', '1900-xxxx'),
'invoiceUrl' => rtrim(env('FRONTEND_URL', config('app.url')), '/') . '/hoa-don/' . ($this->data['order_id'] ?? ''),
],
htmlString: $this->renderFromTemplate('vm_creation_failed', $this->vars())['html'],
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
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'),
];
}
}