Files
portal-api/app/Mail/Customer/DepositSuccess.php
T

51 lines
1.8 KiB
PHP

<?php
namespace App\Mail\Customer;
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;
public array $data;
public function __construct(array $data)
{
$this->data = $data;
}
public function envelope(): Envelope
{
return new Envelope(
subject: 'V/v: Thông báo nạp tiền thành công - ' . number_format($this->data['amount']) . ' VNĐ',
);
}
public function content(): Content
{
return new Content(
view: 'emails.customer.deposit-success',
with: [
'customerName' => $this->data['customer_name'] ?? 'Khách hàng',
'transactionCode' => $this->data['transaction_code'] ?? 'N/A',
'amount' => $this->data['amount'] ?? 0,
'amountFormatted' => number_format($this->data['amount']) ?? '0',
'credit' => $this->data['credit'] ?? 0,
'creditFormatted' => number_format($this->data['credit']) ?? '0',
'currentTotal' => $this->data['current_total'] ?? 0,
'currentTotalFormatted' => number_format($this->data['current_total']) ?? '0',
'currentCredit' => $this->data['current_credit'] ?? 0,
'currentCreditFormatted' => number_format($this->data['current_credit']) ?? '0',
'depositDate' => $this->data['deposit_date'] ?? now()->format('d/m/Y H:i:s'),
'supportEmail' => config('mail.support_email', 'support@thegioiso.com'),
'supportPhone' => config('mail.support_phone', '1900.xxxx'),
],
);
}
}