feat(tenant): separate admin and storefront website types
This commit is contained in:
@@ -148,6 +148,18 @@ class UpdateTenantRequest extends FormRequest
|
||||
'min:0',
|
||||
'max:99.99',
|
||||
],
|
||||
'admin_website_type_code' => ['sometimes', 'nullable', 'string', Rule::exists('admin_website_types', 'codigo')],
|
||||
'storefront_website_type_code' => [
|
||||
'sometimes',
|
||||
'nullable',
|
||||
'string',
|
||||
Rule::exists('storefront_website_types', 'codigo'),
|
||||
function (string $attribute, mixed $value, Closure $fail) use ($tenant): void {
|
||||
if ($tenant && $value !== $tenant->storefront_website_type_code && $tenant->websiteExtras()->exists()) {
|
||||
$fail('The storefront website type cannot be changed while the tenant has extras.');
|
||||
}
|
||||
},
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user