Files
portal-api/app/Mail/Customer/VMCreationFailed.php

65 lines
1.9 KiB
PHP

<?php
namespace App\Mail\Customer;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
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;
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'),
);
}
/**
* 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'] ?? ''),
],
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}