- Created migration to add 'group_label' to 'product_type_fields' table. - Implemented ItSupportCatalogSeeder to populate IT Support features and tiers. - Added ProductCategorySeeder for initial product categories. - Developed ProductMockupSeeder for mockup products in various categories. - Introduced ProductTypeFieldSeeder to define fields for different product types. - Created email templates for VPS service information and service renewal reminders.
47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Models\Customer;
|
|
use App\Models\Service;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class ServiceRenewalReminderMail extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public function __construct(
|
|
public readonly Customer $customer,
|
|
public readonly Service $service,
|
|
) {}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
$name = $this->service->server_name ?? $this->service->product?->name ?? 'dịch vụ';
|
|
|
|
return new Envelope(subject: "Nhắc gia hạn dịch vụ {$name}");
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
view: 'emails.customer.service-renewal-reminder',
|
|
with: [
|
|
'clientName' => $this->customer->fullname ?? '',
|
|
'productName' => $this->service->product?->name ?? 'Dịch vụ',
|
|
'serverName' => $this->service->server_name ?? '',
|
|
'expiresAt' => $this->service->expires_at
|
|
? \Carbon\Carbon::parse($this->service->expires_at)->format('d/m/Y')
|
|
: 'N/A',
|
|
'price' => $this->service->orderItem?->price
|
|
? number_format((float) $this->service->orderItem->price, 0, ',', '.')
|
|
: null,
|
|
],
|
|
);
|
|
}
|
|
}
|