mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 07:32:48 +08:00
validate的场景可以使用回调方法(支持闭包)而不是固定的字段
This commit is contained in:
@@ -256,9 +256,14 @@ class Validate
|
|||||||
$title = $key;
|
$title = $key;
|
||||||
}
|
}
|
||||||
// 场景检测
|
// 场景检测
|
||||||
if (!empty($scene) && !in_array($key, $scene)) {
|
if (!empty($scene)) {
|
||||||
continue;
|
if ($scene instanceof \Closure && call_user_func_array($scene, [$key, &$data])) {
|
||||||
|
continue;
|
||||||
|
} elseif (is_array($scene) && !in_array($key, $scene)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取数据 支持二维数组
|
// 获取数据 支持二维数组
|
||||||
$value = $this->getDataValue($data, $key);
|
$value = $this->getDataValue($data, $key);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user