data = $data; } public function envelope(): Envelope { return new Envelope( subject: $this->renderFromTemplate('order_payment_success', $this->vars())['subject'], ); } public function content(): Content { return new Content( htmlString: $this->renderFromTemplate('order_payment_success', $this->vars())['html'], ); } public function attachments(): array { return []; } private function vars(): array { $vmRows = ''; foreach ($this->data['vm_results'] ?? [] as $vm) { $rows = ''; if (!empty($vm['ip'])) { $rows .= '
🌐 IP Address' . $vm['ip'] . '
'; } if (!empty($vm['username'])) { $rows .= '
👤 Username' . $vm['username'] . '
'; } if (!empty($vm['password'])) { $rows .= '
🔑 Password' . $vm['password'] . '
'; } if (!empty($vm['os'])) { $rows .= '
💿 Hệ điều hành' . $vm['os'] . '
'; } $vmRows .= '
' . $rows . '
'; } $vmBlock = $vmRows ? '
Thông tin dịch vụ Cloud VPS
' . $vmRows : ''; $addonRows = ''; foreach ($this->data['addons_summary'] ?? [] as $addon) { $addonRows .= '' . $addon['name'] . '' . $addon['qty'] . '' . number_format((float) $addon['subtotal'], 0, ',', '.') . ' VNĐ'; } $addonBlock = $addonRows ? '
Gói nâng cấp cấu hình (Addon)
' . $addonRows . '
Dịch vụ addonSố lượngThành tiền
' : ''; return [ 'customer_name' => $this->data['customer_name'] ?? 'Khách hàng', 'order_num' => $this->data['order_num'] ?? 'N/A', 'amount_formatted'=> number_format((float) ($this->data['amount'] ?? 0), 0, ',', '.'), 'vm_block' => $vmBlock, 'addon_block' => $addonBlock, 'support_email' => config('mail.support_email', 'support@example.com'), 'support_phone' => config('mail.support_phone', '1900-xxxx'), ]; } }