feat(notification): implement branding for emails using WebsiteType and update templates

This commit is contained in:
2026-08-25 10:36:50 -03:00
parent 843659583e
commit 0c8419a5eb
8 changed files with 116 additions and 29 deletions

View File

@@ -21,7 +21,7 @@ class NotificationMailService
public function sendWelcome(int $userId, string $tenantCode): void
{
$tenant = Tenant::query()->where('codigo', $tenantCode)->firstOrFail();
$tenant = Tenant::query()->with('websiteType')->where('codigo', $tenantCode)->firstOrFail();
$user = User::query()->findOrFail($userId);
$this->mailService
@@ -30,6 +30,7 @@ class NotificationMailService
$user->email,
"Bienvenido a {$tenant->nombre}",
view('mail.notifications.welcome', compact('tenant', 'user'))->render(),
$tenant->websiteType ?? $tenant,
);
}
@@ -81,7 +82,13 @@ class NotificationMailService
->send(
$attempt->user->email,
"Código para recuperar tu contraseña - {$tenant->nombre}",
view('mail.notifications.password-reset', compact('tenant', 'attempt', 'recoveryUrl'))->render(),
view('mail.notifications.password-reset', [
'tenant' => $tenant,
'attempt' => $attempt,
'recoveryUrl' => $recoveryUrl,
'brand' => $tenant->websiteType ?? $tenant,
])->render(),
$tenant->websiteType ?? $tenant,
);
}