42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
||
|
||
namespace App\Http\Requests\Category;
|
||
|
||
use Illuminate\Foundation\Http\FormRequest;
|
||
use Illuminate\Validation\Rule;
|
||
|
||
class UpdateCategoryRequest extends FormRequest
|
||
{
|
||
public function authorize(): bool
|
||
{
|
||
return true;
|
||
}
|
||
|
||
/**
|
||
* @return array<string, array<int, mixed>>
|
||
*/
|
||
public function rules(): array
|
||
{
|
||
return [
|
||
'slug' => ['required', 'string', 'max:255', Rule::unique('categories', 'slug')->ignore($this->route('category'))],
|
||
'label' => ['required', 'string', 'max:255'],
|
||
'desc' => ['nullable', 'string'],
|
||
'image' => ['nullable', 'string', 'max:255'],
|
||
'meta_title' => ['nullable', 'string', 'max:255'],
|
||
'meta_description' => ['nullable', 'string'],
|
||
];
|
||
}
|
||
|
||
/**
|
||
* @return array<string, string>
|
||
*/
|
||
public function messages(): array
|
||
{
|
||
return [
|
||
'slug.required' => 'Slug alanı zorunludur.',
|
||
'slug.unique' => 'Bu slug zaten kullanılıyor.',
|
||
'label.required' => 'Kategori adı zorunludur.',
|
||
];
|
||
}
|
||
}
|