update email template

This commit is contained in:
baodev0
2026-09-09 16:56:22 +07:00
parent d3d9f76ba0
commit 2365ef72e9
210 changed files with 6335 additions and 4688 deletions
+17 -14
View File
@@ -2,6 +2,7 @@
namespace App\Mail\Customer;
use App\Mail\Concerns\RequiresDbTemplate;
use App\Models\Setting;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
@@ -11,32 +12,21 @@ use Illuminate\Queue\SerializesModels;
class VerifyAccount extends Mailable
{
use Queueable, SerializesModels;
use Queueable, SerializesModels, RequiresDbTemplate;
public function __construct(public array $data) {}
public function envelope(): Envelope
{
$appName = $this->payload()['company_name'] ?? config('app.name', 'The Gioi So');
return new Envelope(
subject: '[' . $appName . '] Mã xác thực tài khoản của bạn',
subject: $this->renderFromTemplate('verify_account_welcome', $this->vars())['subject'],
);
}
public function content(): Content
{
$data = $this->payload();
return new Content(
view: 'emails.customer.verify-account-welcome',
with: [
'appName' => $data['company_name'] ?? config('app.name', 'The Gioi So'),
'fullName' => $data['fullname'] ?? 'Quý khách',
'verifyCode' => $data['verify_code'] ?? '',
'supportEmail' => $data['support_email'] ?? config('mail.support_email', 'support@thegioiso.com'),
'supportPhone' => $data['support_phone'] ?? config('mail.support_phone', '1900.xxxx'),
],
htmlString: $this->renderFromTemplate('verify_account_welcome', $this->vars())['html'],
);
}
@@ -60,4 +50,17 @@ class VerifyAccount extends Mailable
'support_phone' => $settingValue['hotline'] ?? ($settingValue['phone'] ?? config('mail.support_phone', '1900.xxxx')),
], $this->data);
}
private function vars(): array
{
$data = $this->payload();
return [
'app_name' => $data['company_name'] ?? config('app.name', 'The Gioi So'),
'full_name' => $data['fullname'] ?? 'Quý khách',
'verify_code' => $data['verify_code'] ?? '',
'support_email' => $data['support_email'] ?? config('mail.support_email', 'support@thegioiso.com'),
'support_phone' => $data['support_phone'] ?? config('mail.support_phone', '1900.xxxx'),
];
}
}