renderFromTemplate('hosting_account_created', $this->vars())['subject'], ); } public function content(): Content { return new Content( htmlString: $this->renderFromTemplate('hosting_account_created', $this->vars())['html'], ); } public function attachments(): array { return []; } private function payload(): array { try { $setting = Setting::where('key', 'setting')->first(); $settingValue = $setting ? json_decode((string) $setting->value, true) : []; } catch (\Throwable) { $settingValue = []; } return array_merge([ 'company_name' => $settingValue['company'] ?? config('app.name', 'The Gioi So'), 'support_email' => $settingValue['email'] ?? config('mail.support_email', 'support@thegioiso.com'), 'support_phone' => $settingValue['hotline'] ?? ($settingValue['phone'] ?? config('mail.support_phone', '1900.xxxx')), 'login_url' => rtrim(config('app.frontend_url', ''), '/') . '/dang-nhap', ], $this->data); } private function vars(): array { $data = $this->payload(); $row = fn (string $label, ?string $value) => $value ? "{$label}{$value}" : ''; $pleskBlock = ''; if (!empty($data['plesk_login'])) { $pleskBlock = '

TÀI KHOẢN ĐĂNG NHẬP PLESK PANEL

' . '' . '' . '' . (!empty($data['plesk_password']) ? '' : '') . '
Địa chỉ Panel:' . ($data['plesk_panel_url'] ?? '') . '
Tên đăng nhập:' . ($data['plesk_login'] ?? '') . '
Mật khẩu:' . $data['plesk_password'] . '
'; } return [ 'app_name' => $data['company_name'] ?? config('app.name', 'The Gioi So'), 'full_name' => $data['customer_name'] ?? 'Quý khách', 'domain_name' => $data['domain_name'] ?? '', 'hosting_plan' => $data['hosting_plan'] ?? '', 'server_host_row' => $row('Máy chủ / FTP Host:', $data['server_host'] ?? null), 'ftp_username_row' => $row('Tài khoản FTP:', $data['ftp_username'] ?? null), 'ftp_password_row' => $row('Mật khẩu FTP:', $data['ftp_password'] ?? null), 'ftp_password_notice' => !empty($data['ftp_password']) ? '

Lưu ý: Vì lý do bảo mật, mật khẩu FTP chỉ được gửi một lần duy nhất qua email và không được lưu trữ trên hệ thống. Vui lòng lưu lại ở nơi an toàn.

' : '', 'plesk_block' => $pleskBlock, 'login_url' => $data['login_url'] ?? rtrim(config('app.frontend_url', ''), '/') . '/dang-nhap', 'support_email' => $data['support_email'] ?? config('mail.support_email', 'support@thegioiso.com'), 'support_phone' => $data['support_phone'] ?? config('mail.support_phone', '1900.xxxx'), ]; } }