DynamicQueryRequest.php
926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace App\Http\Container\AppSection\Requests;
use Hikoon\LaravelApi\Support\ApiRequest;
class DynamicQueryRequest extends ApiRequest
{
protected function prepareForValidation(): void
{
$this->mergeIfMissing([
'pageSize' => 20
]);
}
/**
* @return string[]
*/
public function rules(): array
{
return [
'user_id' => 'required|integer',
'type' => 'required|in:image,video,audio',
'pageSize' => 'required|integer|max:100'
];
}
/**
* @return string[]
*/
public function messages(): array
{
return [
'user_id.required' => '请选择查看用户',
'type.required' => '请选择查看方式',
'type.in' => '查看方式不存在',
'pageSize' => '每页显示数不能超过:max'
];
}
}