mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进model类的auto和validate方法
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user