From da3e011ba3afc6d4b2843c1e61de203579abf663 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 6 Mar 2016 20:25:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bmodel=E7=B1=BB=E7=9A=84auto?= =?UTF-8?q?=E5=92=8Cvalidate=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index c0b6b65a..7255b8ce 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1766,7 +1766,7 @@ class Model public function validate($field = true, $rule = null) { if (is_array($field) || is_null($rule)) { - $this->options['validate'] = $field; + $this->options['validate'] = true === $field ? $this->name : $field; } else { $this->options['validate'][$field] = $rule; } @@ -1783,7 +1783,7 @@ class Model public function auto($field = true, $rule = null) { if (is_array($field) || is_null($rule)) { - $this->options['auto'] = $field; + $this->options['auto'] = true === $field ? $this->name : $field; } else { $this->options['auto'][$field] = $rule; }