Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
* @param array $data 数据
* @param string|array $validate 验证器类名或者验证规则数组
* @param array $message 错误提示信息
* @param string $scene 设置场景
* @param bool $batch 是否批量验证
* @param bool $failException 是否抛出异常
* @return bool
*/
function validate(array $data, $validate = '', array $message = [], bool $batch = false, bool $failException = true):bool
function validate(array $data, $validate = '', array $message = [], bool $batch = false, bool $failException = true, string $scene = ''):bool
{
if (is_array($validate)) {
$v = new Validate();
Expand All @@ -33,6 +34,6 @@ function validate(array $data, $validate = '', array $message = [], bool $batch
}
}

return $v->message($message)->batch($batch)->failException($failException)->check($data);
return $v->message($message)->batch($batch)->failException($failException)->scene($scene)->check($data);
}
}
}