41 lines
1 KiB
PHP
41 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Front;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class PostsRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'page' => ['required', 'integer'],
|
|
'category' => ['required', 'string'],
|
|
'locale' => ['required', 'string'],
|
|
|
|
'filters' => ['nullable', 'array'],
|
|
'filters.order' => ['nullable', 'string', 'in:asc,desc'],
|
|
|
|
'filters.tags' => ['nullable', 'array'],
|
|
'filters.tags.*'=> ['string'],
|
|
|
|
'filters.years' => ['nullable', 'array'],
|
|
'filters.years.*' => ['string'],
|
|
];
|
|
}
|
|
}
|