Model类增加全局查询范围定义 改进Query类

This commit is contained in:
thinkphp
2016-06-02 14:18:18 +08:00
parent 5048f7c767
commit 625a8767c5
2 changed files with 15 additions and 6 deletions

View File

@@ -964,7 +964,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
} else {
$query->name($this->name);
}
// 全局作用域
if (method_exists($this, 'base')) {
call_user_func_array([$this, 'base'], [ & $query]);
}
self::$links[$model] = $query;
}
// 返回当前模型的数据库查询对象