update email template
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Mail\Admin;
|
||||
|
||||
use App\Mail\Concerns\RequiresDbTemplate;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
@@ -12,22 +13,21 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class HostingAccountCreatedAdminNotification extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
use Queueable, SerializesModels, RequiresDbTemplate;
|
||||
|
||||
public function __construct(public readonly array $data) {}
|
||||
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: '[ADMIN] Hosting account mới — ' . ($this->data['domain_name'] ?? 'N/A'),
|
||||
subject: $this->renderFromTemplate('admin_hosting_account_created', $this->vars())['subject'],
|
||||
);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'emails.admin.hosting-account-created',
|
||||
with: $this->data,
|
||||
htmlString: $this->renderFromTemplate('admin_hosting_account_created', $this->vars())['html'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -35,4 +35,29 @@ class HostingAccountCreatedAdminNotification extends Mailable
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function vars(): array
|
||||
{
|
||||
$row = fn (string $label, ?string $value) => $value
|
||||
? '<div class="cred-row"><span class="cred-label">' . $label . '</span><span class="cred-value">' . e($value) . '</span></div>'
|
||||
: '';
|
||||
|
||||
return [
|
||||
'domain_name' => $this->data['domain_name'] ?? 'N/A',
|
||||
'created_at' => $this->data['created_at'] ?? now()->format('d/m/Y H:i:s'),
|
||||
'customer_name' => $this->data['customer_name'] ?? 'N/A',
|
||||
'customer_email' => $this->data['customer_email'] ?? 'N/A',
|
||||
'hosting_plan' => $this->data['hosting_plan'] ?? 'N/A',
|
||||
'server_name' => $this->data['server_name'] ?? 'N/A',
|
||||
'server_ip' => $this->data['server_ip'] ?? 'N/A',
|
||||
'plesk_client_id' => $this->data['plesk_client_id'] ?? 'N/A',
|
||||
'plesk_subscription_id' => $this->data['plesk_subscription_id'] ?? 'N/A',
|
||||
'ftp_username' => $this->data['ftp_username'] ?? 'N/A',
|
||||
'ftp_password_row' => $row('🔑 FTP Password', $this->data['ftp_password'] ?? null),
|
||||
'plesk_panel_url' => $this->data['plesk_panel_url'] ?? 'N/A',
|
||||
'plesk_login' => $this->data['plesk_login'] ?? 'N/A',
|
||||
'plesk_password_row' => $row('🔑 Password', $this->data['plesk_password'] ?? null),
|
||||
'company_name' => $this->data['company_name'] ?? 'Portal Admin',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user