60 lines
2.4 KiB
PHP
60 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Mail\Customer;
|
|
|
|
use App\Mail\TemplateMailable;
|
|
use App\Support\EmailTemplateShell;
|
|
use App\Support\MailGlobals;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class HostingAccountCreated extends TemplateMailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public function __construct(public array $data) {}
|
|
|
|
public function attachments(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
protected function scenario(): string
|
|
{
|
|
return 'hosting_account_created';
|
|
}
|
|
|
|
protected function variables(): array
|
|
{
|
|
$data = [...MailGlobals::values(), ...$this->data];
|
|
|
|
$row = fn (string $label, ?string $value) => $value
|
|
? EmailTemplateShell::row($label, e($value))
|
|
: '';
|
|
|
|
$pleskBlock = '';
|
|
if (!empty($data['plesk_login'])) {
|
|
$pleskBlock = EmailTemplateShell::paragraph('<strong style="color: #f16723;">TÀI KHOẢN ĐĂNG NHẬP PLESK PANEL</strong>')
|
|
. EmailTemplateShell::infoTable(array_filter([
|
|
'Địa chỉ Panel' => '<a style="color: #f16723; text-decoration: none;" href="' . e($data['plesk_panel_url'] ?? '') . '" target="_blank" rel="noopener">' . e($data['plesk_panel_url'] ?? '') . '</a>',
|
|
'Tên đăng nhập' => e($data['plesk_login']),
|
|
'Mật khẩu' => !empty($data['plesk_password']) ? e($data['plesk_password']) : null,
|
|
]));
|
|
}
|
|
|
|
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'])
|
|
? '<p style="text-align: justify; color: #b45309; font-size: 13px;">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.</p>'
|
|
: '',
|
|
'plesk_block' => $pleskBlock,
|
|
];
|
|
}
|
|
}
|