update email template
This commit is contained in:
@@ -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,34 +12,21 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class VmPasswordChanged 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: 'Mật khẩu VM của bạn đã được thay đổi — ' . $appName,
|
||||
subject: $this->renderFromTemplate('vm_password_changed', $this->vars())['subject'],
|
||||
);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
$data = $this->payload();
|
||||
|
||||
return new Content(
|
||||
view: 'emails.customer.vm-password-changed',
|
||||
with: [
|
||||
'appName' => $data['company_name'] ?? config('app.name', 'The Gioi So'),
|
||||
'fullName' => $data['fullname'] ?? 'Quý khách',
|
||||
'vmName' => $data['vm_name'] ?? '',
|
||||
'newPassword' => $data['newPassword'] ?? '',
|
||||
'loginUrl' => $data['login_url'] ?? rtrim(config('app.frontend_url', ''), '/') . '/dang-nhap',
|
||||
'supportEmail' => $data['support_email'] ?? config('mail.support_email', 'support@thegioiso.com'),
|
||||
'supportPhone' => $data['support_phone'] ?? config('mail.support_phone', '1900.xxxx'),
|
||||
],
|
||||
htmlString: $this->renderFromTemplate('vm_password_changed', $this->vars())['html'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -63,4 +51,22 @@ class VmPasswordChanged extends Mailable
|
||||
'login_url' => rtrim(config('app.frontend_url', ''), '/') . '/dang-nhap',
|
||||
], $this->data);
|
||||
}
|
||||
|
||||
private function vars(): array
|
||||
{
|
||||
$data = $this->payload();
|
||||
$newPassword = $data['newPassword'] ?? '';
|
||||
|
||||
return [
|
||||
'app_name' => $data['company_name'] ?? config('app.name', 'The Gioi So'),
|
||||
'full_name' => $data['fullname'] ?? 'Quý khách',
|
||||
'vm_name' => $data['vm_name'] ?? '',
|
||||
'new_password_row' => $newPassword
|
||||
? '<div>Mật khẩu mới: <strong style="font-family: \'Menlo\',\'Consolas\',monospace; color: #111827;">' . $newPassword . '</strong></div>'
|
||||
: '',
|
||||
'login_url' => $data['login_url'] ?? rtrim(config('app.frontend_url', ''), '/') . '/dang-nhap',
|
||||
'support_email' => $data['support_email'] ?? config('mail.support_email', 'support@thegioiso.com'),
|
||||
'support_phone' => $data['support_phone'] ?? config('mail.support_phone', '1900.xxxx'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user