Files
portal-api/app/Mail/Admin/DomainOrderNewNotification.php
T
baodev0 dfb926055d Add feature tests for domain order management
- Implement AdminDomainOrderTest to cover admin functionalities for domain orders including listing, confirming registration, KYC updates, activation, rejection, and refunds.
- Implement ClientDomainOrderTest to cover client functionalities for placing domain orders, including validation for balance, duplicate orders, and domain normalization.
- Ensure proper handling of domain pricing and service statuses throughout the tests.
2026-07-10 14:16:35 +07:00

44 lines
1.4 KiB
PHP

<?php
namespace App\Mail\Admin;
use App\Models\Template;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class DomainOrderNewNotification extends Mailable
{
use Queueable, SerializesModels;
public function __construct(
protected Template $template,
protected array $data,
) {}
public function envelope(): Envelope
{
return new Envelope(
subject: str_replace('{\$domain_name}', $this->data['domain_name'] ?? '', $this->template->subject),
);
}
public function content(): Content
{
$message = str_replace(
['{\$company_name}', '{\$company_logo}', '{\$domain_name}', '{\$customer_name}', '{\$customer_email}', '{\$order_num}', '{\$order_total}', '{\$created_at}', '{\$admin_url}'],
[$this->data['company_name'] ?? '', $this->data['company_logo'] ?? '', $this->data['domain_name'] ?? '', $this->data['customer_name'] ?? '', $this->data['customer_email'] ?? '', $this->data['order_num'] ?? '', $this->data['order_total'] ?? '', $this->data['created_at'] ?? '', $this->data['admin_url'] ?? ''],
$this->template->message
);
return new Content(view: 'emails.template', with: ['template' => $message]);
}
public function attachments(): array
{
return [];
}
}