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

56 lines
1.5 KiB
PHP

<?php
namespace App\Mail;
use App\Mail\Concerns\RequiresDbTemplate;
use App\Models\Customer;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class VmSuspendedMail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels, RequiresDbTemplate;
public function __construct(
public readonly Customer $customer,
public readonly string $vmName,
public readonly string $vmwareId,
) {}
public function envelope(): Envelope
{
return new Envelope(
subject: $this->renderFromTemplate('vm_suspended', $this->vars())['subject'],
);
}
public function content(): Content
{
return new Content(
htmlString: $this->renderFromTemplate('vm_suspended', $this->vars())['html'],
);
}
public function attachments(): array
{
return [];
}
private function vars(): array
{
return [
'customer_name' => $this->customer->fullname,
'vm_name' => $this->vmName,
'vmware_id' => $this->vmwareId,
'suspended_at' => now()->setTimezone('Asia/Ho_Chi_Minh')->format('d/m/Y H:i'),
'login_url' => rtrim(config('app.frontend_url', ''), '/') . '/dang-nhap',
'support_email' => 'support@tgs.com.vn',
'support_phone' => '(028) 7309. 7379',
];
}
}