update
This commit is contained in:
@@ -14,6 +14,7 @@ use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\Validation\Contract\ValidatorFactoryInterface;
|
||||
use Hyperf\Validation\Validator as HyperfValidator;
|
||||
use RuntimeException;
|
||||
use Hyperf\Collection\Arr;
|
||||
|
||||
abstract class Validator
|
||||
{
|
||||
@@ -128,6 +129,17 @@ abstract class Validator
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待验证数据中指定键的值.
|
||||
* 如果不存在该键,则返回null.
|
||||
* @param string $key 待获取的键名
|
||||
* @return mixed 键对应的值
|
||||
*/
|
||||
protected function getDataByKey(string $key): mixed
|
||||
{
|
||||
return Arr::get($this->data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义场景验证规则(子类实现).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user