52 lines
1.8 KiB
PHP
52 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Mail\Customer;
|
|
|
|
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 DepositSuccess extends Mailable
|
|
{
|
|
use Queueable, SerializesModels, RequiresDbTemplate;
|
|
|
|
public array $data;
|
|
|
|
public function __construct(array $data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
return new Envelope(
|
|
subject: $this->renderFromTemplate('customer_deposit_success', $this->vars())['subject'],
|
|
);
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
htmlString: $this->renderFromTemplate('customer_deposit_success', $this->vars())['html'],
|
|
);
|
|
}
|
|
|
|
private function vars(): array
|
|
{
|
|
return [
|
|
'customer_name' => $this->data['customer_name'] ?? 'Khách hàng',
|
|
'transaction_code' => $this->data['transaction_code'] ?? 'N/A',
|
|
'amount_formatted' => number_format((float) ($this->data['amount'] ?? 0)),
|
|
'credit_formatted' => number_format((float) ($this->data['credit'] ?? 0)),
|
|
'current_total_formatted' => number_format((float) ($this->data['current_total'] ?? 0)),
|
|
'current_credit_formatted' => number_format((float) ($this->data['current_credit'] ?? 0)),
|
|
'deposit_date' => $this->data['deposit_date'] ?? now()->format('d/m/Y H:i:s'),
|
|
'support_email' => config('mail.support_email', 'support@thegioiso.com'),
|
|
'support_phone' => config('mail.support_phone', '1900.xxxx'),
|
|
];
|
|
}
|
|
}
|