Files
portal-api/app/Mail/CreateHosting.php
T
2026-09-09 16:56:22 +07:00

56 lines
1.9 KiB
PHP

<?php
namespace App\Mail;
use App\Mail\Concerns\RequiresDbTemplate;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class CreateHosting extends Mailable
{
use Queueable, SerializesModels, RequiresDbTemplate;
/** @param int $template Không còn dùng — scenario cố định 'hosting_information'. Giữ tham số để không phá vỡ caller hiện tại. */
public function __construct($template = 0, public $data = []) {}
public function envelope(): Envelope
{
return new Envelope(
subject: $this->renderFromTemplate('hosting_information', $this->vars())['subject'],
);
}
public function content(): Content
{
return new Content(
htmlString: $this->renderFromTemplate('hosting_information', $this->vars())['html'],
);
}
public function attachments(): array
{
return [];
}
private function vars(): array
{
return [
'company_name' => $this->data['company_name'] ?? '',
'company_logo' => $this->data['company_logo'] ?? '',
'client_name' => $this->data['client_name'] ?? '',
'product_name' => $this->data['product_name'] ?? '',
'product_billing' => $this->data['product_billing'] ?? '',
'product_price' => $this->data['product_price'] ?? '',
'service_host' => $this->data['service_host'] ?? '',
'service_username'=> $this->data['service_username'] ?? '',
'service_password'=> $this->data['service_password'] ?? '',
'service_due_exp' => $this->data['service_due_exp'] ?? '',
'ftp_account' => $this->data['ftp_account'] ?? '',
'ftp_password' => $this->data['ftp_password'] ?? '',
];
}
}