34 lines
921 B
PHP
34 lines
921 B
PHP
<?php
|
|
|
|
namespace App\Domains\Tenant\Requests;
|
|
|
|
use App\Domains\Tenant\Models\TenantProp;
|
|
use App\Domains\Shared\Enums\FieldType;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class UpdateTenantPropRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
/** @var TenantProp|null $tenantProp */
|
|
$tenantProp = $this->route('tenantProp');
|
|
|
|
return [
|
|
'codigo' => ['required', 'string', 'max:255', Rule::unique('tenant_props', 'codigo')->ignore($tenantProp?->id)],
|
|
'nombre' => ['required', 'string', 'max:255'],
|
|
'descripcion' => ['nullable', 'string'],
|
|
'is_required' => ['sometimes', 'boolean'],
|
|
'data_type' => ['required', Rule::enum(FieldType::class)],
|
|
];
|
|
}
|
|
}
|