43 lines
1.4 KiB
PHP
43 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Mail\Admin;
|
|
|
|
use App\Mail\TemplateMailable;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class AdminPaymentReceived extends TemplateMailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public function __construct(public readonly array $data) {}
|
|
|
|
public function attachments(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
protected function scenario(): string
|
|
{
|
|
return 'admin_payment_received';
|
|
}
|
|
|
|
protected function variables(): array
|
|
{
|
|
return [
|
|
'company_name' => $this->data['company_name'] ?? config('app.name'),
|
|
'payment_type' => $this->data['payment_type'] ?? 'Hóa đơn',
|
|
'reference' => $this->data['reference'] ?? 'N/A',
|
|
'invoice_number' => $this->data['invoice_number'] ?? 'N/A',
|
|
'customer_name' => $this->data['customer_name'] ?? 'N/A',
|
|
'customer_email' => $this->data['customer_email'] ?? 'N/A',
|
|
'amount_formatted' => number_format((float) ($this->data['amount'] ?? 0), 0, ',', '.') . ' VNĐ',
|
|
'outstanding_formatted' => number_format((float) ($this->data['outstanding'] ?? 0), 0, ',', '.') . ' VNĐ',
|
|
'payment_status' => ($this->data['outstanding'] ?? 0) > 0 ? 'Thanh toán một phần' : 'Đã thanh toán đủ',
|
|
'created_at' => $this->data['created_at'] ?? now()->format('d/m/Y H:i:s'),
|
|
];
|
|
}
|
|
}
|