update email template
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Mail\Customer;
|
||||
|
||||
use App\Mail\Concerns\RequiresDbTemplate;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
@@ -10,7 +11,7 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DepositSuccess extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
use Queueable, SerializesModels, RequiresDbTemplate;
|
||||
|
||||
public array $data;
|
||||
|
||||
@@ -22,29 +23,29 @@ class DepositSuccess extends Mailable
|
||||
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Đ',
|
||||
subject: $this->renderFromTemplate('customer_deposit_success', $this->vars())['subject'],
|
||||
);
|
||||
}
|
||||
|
||||
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'),
|
||||
],
|
||||
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'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user