30 lines
763 B
PHP
30 lines
763 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Http\Requests;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Validation\Rule;
|
||
|
|
|
||
|
|
class StoreCategoryRequest extends FormRequest
|
||
|
|
{
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return array<string, mixed>
|
||
|
|
*/
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'parent_id' => ['nullable', 'exists:categories,id'],
|
||
|
|
'name' => ['required', 'string', 'max:255'],
|
||
|
|
'slug' => ['nullable', 'string', 'max:255', Rule::unique('categories', 'slug')],
|
||
|
|
'description' => ['nullable', 'string'],
|
||
|
|
'meta_title' => ['nullable', 'string', 'max:60'],
|
||
|
|
'meta_description' => ['nullable', 'string', 'max:160'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|