We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 395377b commit 9ae5a61Copy full SHA for 9ae5a61
README.md
@@ -98,14 +98,14 @@ class PageRequest extends Validation
98
{
99
return [
100
['tagId,title,userId,freeTime', 'required'],
101
- ['tagId', 'size', 'min'=>4, 'max'=>567], // 4<= tagId <=567
102
- ['title', 'min', 40],
+ ['tagId', 'size', 'min'=>4, 'max'=>567, 'filter' => 'int'], // 4<= tagId <=567
+ ['title', 'min', 40, 'filter' => 'trim'],
103
['freeTime', 'number'],
104
['tagId', 'number', 'when' => function($data) {
105
return isset($data['status']) && $data['status'] > 2;
106
}],
107
- ['userId', 'number', 'on' => 'scene1' ],
108
- ['username', 'string', 'on' => 'scene2' ],
+ ['userId', 'number', 'on' => 'scene1', 'filter' => 'int'],
+ ['username', 'string', 'on' => 'scene2', 'filter' => 'trim'],
109
['username', 'regexp' ,'/^[a-z]\w{2,12}$/'],
110
['title', 'customValidator', 'msg' => '{attr} error msg!' ], // 指定当前规则的消息
111
['status', function($status) { // 直接使用闭包验证
0 commit comments