升级到5.1.28版本

This commit is contained in:
巴掌 committed 2018-11-01 09:01:46 +08:00
1 parent 4bc2bfa35a
commit 81d9f5e5e5
23 files changed
+321 -150

No files matched your search

+35 -3
View File
@@ -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