feat(tenant): separate admin and storefront website types
This commit is contained in:
@@ -31,7 +31,7 @@ class NotificationMailService
|
||||
'user_id' => $userId,
|
||||
'tenant_code' => $tenantCode,
|
||||
];
|
||||
$tenant = Tenant::query()->with('websiteType')->where('codigo', $tenantCode)->firstOrFail();
|
||||
$tenant = Tenant::query()->where('codigo', $tenantCode)->firstOrFail();
|
||||
$user = User::query()->findOrFail($userId);
|
||||
|
||||
$this->sendIdempotently(
|
||||
@@ -41,7 +41,7 @@ class NotificationMailService
|
||||
$context,
|
||||
$user->email,
|
||||
function () use ($user, $tenant, $tenantCode): array {
|
||||
$brand = $tenant->websiteType ?? $tenant;
|
||||
$brand = $tenant;
|
||||
$tenantUrl = 'https://'.$tenant->dominio.$tenant->base_path;
|
||||
|
||||
$this->mailService
|
||||
@@ -54,7 +54,7 @@ class NotificationMailService
|
||||
);
|
||||
|
||||
return [
|
||||
'brand_type' => $tenant->websiteType === null ? 'tenant' : 'website_type',
|
||||
'brand_type' => 'tenant',
|
||||
];
|
||||
},
|
||||
);
|
||||
@@ -72,7 +72,7 @@ class NotificationMailService
|
||||
];
|
||||
|
||||
$tenant = Tenant::query()
|
||||
->with('websiteType')
|
||||
->with('adminWebsiteType')
|
||||
->where('codigo', $tenantCode)
|
||||
->firstOrFail();
|
||||
$attempt = ResetPasswordAttempt::query()
|
||||
@@ -97,8 +97,8 @@ class NotificationMailService
|
||||
$attempt->user->email,
|
||||
function () use ($attempt, $tenant, $tenantCode, $channel): array {
|
||||
$recoveryDomain = match ($channel) {
|
||||
PasswordResetRequested::CHANNEL_ADMINAPP => $tenant->websiteType?->dominio,
|
||||
PasswordResetRequested::CHANNEL_SCANNER => $tenant->websiteType?->scanner_domain,
|
||||
PasswordResetRequested::CHANNEL_ADMINAPP => $tenant->adminWebsiteType?->dominio,
|
||||
PasswordResetRequested::CHANNEL_SCANNER => $tenant->adminWebsiteType?->scanner_domain,
|
||||
default => $tenant->dominio,
|
||||
};
|
||||
$recoveryBasePath = $channel === PasswordResetRequested::CHANNEL_STOREFRONT
|
||||
@@ -115,7 +115,9 @@ class NotificationMailService
|
||||
$recoveryUrl = $recoveryDomain === null
|
||||
? null
|
||||
: 'https://'.$recoveryDomain.$recoveryBasePath.'/recuperar-contrasena/codigo?'.http_build_query($recoveryQuery);
|
||||
$brand = $tenant->websiteType ?? $tenant;
|
||||
$brand = $channel === PasswordResetRequested::CHANNEL_STOREFRONT
|
||||
? $tenant
|
||||
: ($tenant->adminWebsiteType ?? $tenant);
|
||||
|
||||
[$subject, $template] = match ($attempt->reason) {
|
||||
ResetPasswordAttempt::REASON_STAFF_CREATED => [
|
||||
@@ -291,7 +293,7 @@ class NotificationMailService
|
||||
$newDate,
|
||||
$tickets,
|
||||
): array {
|
||||
$brand = $purchase->tenant->websiteType ?? $purchase->tenant;
|
||||
$brand = $purchase->tenant;
|
||||
|
||||
$this->mailService
|
||||
->forTenant($tenantCode)
|
||||
@@ -392,7 +394,7 @@ class NotificationMailService
|
||||
$disabledTickets,
|
||||
$activeTickets,
|
||||
): array {
|
||||
$brand = $purchase->tenant->websiteType ?? $purchase->tenant;
|
||||
$brand = $purchase->tenant;
|
||||
|
||||
$this->mailService
|
||||
->forTenant($tenantCode)
|
||||
@@ -419,7 +421,7 @@ class NotificationMailService
|
||||
{
|
||||
return Purchase::query()
|
||||
->where('tenant_codigo', $tenantCode)
|
||||
->with(['tenant.websiteType', 'user'])
|
||||
->with(['tenant', 'user'])
|
||||
->find($purchaseId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user