27 lines
680 B
PHP
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',
|
|
];
|
|
}
|
|
}
|