Skip to main content

require_with

Function require_with 

Source
pub fn require_with(
    value: &Value,
    rule: &str,
    data: &Value,
    _field: &str,
) -> bool
Expand description

验证某个字段有值的情况下必须 — 对齐 PHP requireWith

对齐 PHP Validate.php 第 1238-1247 行

§PHP 行为

$val = $this->getDataValue($data, $rule);
if (!empty($val)) {
    return !empty($value) || '0' == $value;
}
return true;