From 60fede47acff886ede4c80fbdec9aa5e896c96e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 19 Mar 2021 18:18:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Validator/Validator.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Validator/Validator.php b/Validator/Validator.php index 88755af6..70505a6c 100644 --- a/Validator/Validator.php +++ b/Validator/Validator.php @@ -148,10 +148,14 @@ class Validator extends BaseValidator { $define = ['field' => $field]; foreach ($rule as $key => $val) { - if (is_string($val) && method_exists($model, $val)) { - $this->validators[] = [$model, $val]; - continue; + + if (!is_null($model)) { + if (is_string($val) && method_exists($model, $val)) { + $this->validators[] = [$model, $val]; + continue; + } } + if (is_string($key)) { $type = strtolower($key); $define['value'] = $val;