55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Mail\Admin;
|
|
|
|
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 TrialRegistrationRequest extends Mailable
|
|
{
|
|
use Queueable, SerializesModels, RequiresDbTemplate;
|
|
|
|
public function __construct(public array $data) {}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
return new Envelope(
|
|
subject: $this->renderFromTemplate('admin_trial_registration_request', $this->vars())['subject'],
|
|
);
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
htmlString: $this->renderFromTemplate('admin_trial_registration_request', $this->vars())['html'],
|
|
);
|
|
}
|
|
|
|
public function attachments(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
private function vars(): array
|
|
{
|
|
return [
|
|
'customer_name' => $this->data['customer_name'] ?? 'N/A',
|
|
'customer_email' => $this->data['customer_email'] ?? 'N/A',
|
|
'customer_phone' => $this->data['customer_phone'] ?? 'N/A',
|
|
'cpu' => $this->data['cpu'] ?? '-',
|
|
'ram' => $this->data['ram'] ?? '-',
|
|
'ssd' => $this->data['ssd'] ?? '-',
|
|
'os' => $this->data['os'] ?? '-',
|
|
'other_row' => !empty($this->data['other'])
|
|
? '<tr><td>Yêu cầu khác</td><td>' . e($this->data['other']) . '</td></tr>'
|
|
: '',
|
|
'company_name' => $this->data['company_name'] ?? 'Portal Admin',
|
|
'created_at' => $this->data['created_at'] ?? now()->format('d/m/Y H:i:s'),
|
|
];
|
|
}
|
|
}
|