46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ListBazaarReviewsRequest extends FormRequest
|
|
{
|
|
protected function prepareForValidation(): void
|
|
{
|
|
if ($this->has('is_replied')) {
|
|
$this->merge([
|
|
'is_replied' => filter_var($this->input('is_replied'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
|
]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'publish_date_after' => ['nullable', 'date'],
|
|
'publish_date_before' => ['nullable', 'date', 'after_or_equal:publish_date_after'],
|
|
'rate_min' => ['nullable', 'integer', 'between:1,5'],
|
|
'rate_max' => ['nullable', 'integer', 'between:1,5'],
|
|
'app_version_code' => ['nullable', 'integer', 'min:1'],
|
|
'sdk_version' => ['nullable', 'integer', 'min:1'],
|
|
'is_replied' => ['nullable', 'boolean'],
|
|
'cursor' => ['nullable', 'string', 'max:2048'],
|
|
];
|
|
}
|
|
}
|