升级到5.1.28版本
This commit is contained in:
1 parent
4bc2bfa35a
commit
81d9f5e5e5
23 files changed
+321
-150
No files matched your search
@@ -87,6 +87,8 @@ class Validate
|
||||
'min' => 'min size of :attribute must be :rule',
|
||||
'after' => ':attribute cannot be less than :rule',
|
||||
'before' => ':attribute cannot exceed :rule',
|
||||
'afterWith' => ':attribute cannot be less than :rule',
|
||||
'beforeWith' => ':attribute cannot exceed :rule',
|
||||
'expire' => ':attribute not within :rule',
|
||||
'allowIp' => 'access IP is not allowed',
|
||||
'denyIp' => 'access IP denied',
|
||||
@@ -422,7 +424,7 @@ class Validate
|
||||
|
||||
// 字段验证
|
||||
if ($rule instanceof \Closure) {
|
||||
$result = call_user_func_array($rule, [$value, $data]);
|
||||
$result = call_user_func_array($rule, [$value, $data, $title, $this]);
|
||||
} elseif ($rule instanceof ValidateRule) {
|
||||
// 验证因子
|
||||
$result = $this->checkItem($key, $value, $rule->getRule(), $data, $rule->getTitle() ?: $title, $rule->getMsg());
|
||||
@@ -1241,9 +1243,10 @@ class Validate
|
||||
* @access public
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @return bool
|
||||
*/
|
||||
public function after($value, $rule)
|
||||
public function after($value, $rule, $data)
|
||||
{
|
||||
return strtotime($value) >= strtotime($rule);
|
||||
}
|
||||
@@ -1253,13 +1256,42 @@ class Validate
|
||||
* @access public
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @return bool
|
||||
*/
|
||||
public function before($value, $rule)
|
||||
public function before($value, $rule, $data)
|
||||
{
|
||||
return strtotime($value) <= strtotime($rule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证日期字段
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @return bool
|
||||
*/
|
||||
protected function afterWith($value, $rule, $data)
|
||||
{
|
||||
$rule = $this->getDataValue($data, $rule);
|
||||
return !is_null($rule) && strtotime($value) >= strtotime($rule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证日期字段
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @return bool
|
||||
*/
|
||||
protected function beforeWith($value, $rule, $data)
|
||||
{
|
||||
$rule = $this->getDataValue($data, $rule);
|
||||
return !is_null($rule) && strtotime($value) <= strtotime($rule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证有效期
|
||||
* @access public
|
||||
|
||||
Reference in new issue
Block a user