ldc-gen-game-web/app/Http/Requests/Bo/Tenants/UpdateTenantRequest.php
2025-08-29 14:46:51 +02:00

46 lines
1.2 KiB
PHP

<?php
namespace App\Http\Requests\Bo\Tenants;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\Rule;
class UpdateTenantRequest extends StoreTenantRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return Gate::check('update', $this->route('tenant'));
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, string>
*/
public function rules(): array
{
/** @var \App\Models\Tenant */
$tenantModel = $this->route('tenant');
return array_merge(parent::rules(), [
'theme' => [
'required',
'string',
'min:3',
'max:255',
Rule::unique('tenants', 'theme')->ignore($tenantModel->getRouteKey())
],
'domain' => [
'required',
'string',
'min:3',
'max:255',
Rule::unique('domains', 'domain')->ignore($tenantModel->domains->first()->getKey())
],
]);
}
}