Files
WMS/Modules/Documentation/Http/Requests/UpdateDocumentationCategoryRequest.php
T
2026-09-21 10:14:57 +01:00

40 lines
1.2 KiB
PHP
Executable File

<?php
namespace Modules\Documentation\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Modules\Documentation\Models\DocumentationCategory;
class UpdateDocumentationCategoryRequest extends FormRequest
{
/**
* Determine whether the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules(): array
{
/** @var DocumentationCategory|null $category */
$category = $this->route('category');
return [
'name' => ['required', 'string', 'max:150'],
'slug' => ['nullable', 'string', 'max:180', Rule::unique('documentation_categories', 'slug')->ignore($category?->id)],
'icon' => ['nullable', 'string', 'max:80'],
'colour' => ['required', 'string', 'max:32'],
'description' => ['nullable', 'string', 'max:2000'],
'sort_order' => ['nullable', 'integer', 'min:0', 'max:999999'],
'is_active' => ['nullable', 'boolean'],
];
}
}