parsaaghayi-backend/app/Http/Requests/Blog/UpdateCategoryRequest.php
parsa aghaei a5f76a3657
Some checks failed
Deploy Backend / deploy (push) Has been cancelled
0.1: replace Request with FormRequest in all controllers
2026-06-23 18:04:57 +03:30

27 lines
680 B
PHP

<?php
namespace App\Http\Requests\Blog;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCategoryRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
$categoryId = $this->route('category');
return [
'name' => 'sometimes|required|string|max:255|unique:categories,name,' . $categoryId,
'slug' => 'sometimes|required|string|unique:categories,slug,' . $categoryId,
'description' => 'sometimes|required|string',
'short_description' => 'nullable|string|max:500',
'image' => 'nullable|url',
];
}
}