mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进Model类
This commit is contained in:
@@ -1365,19 +1365,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
|
|
||||||
public static function __callStatic($method, $params)
|
public static function __callStatic($method, $params)
|
||||||
{
|
{
|
||||||
$query = self::getDb();
|
$query = (new static())->db();
|
||||||
return call_user_func_array([$query, $method], $params);
|
return call_user_func_array([$query, $method], $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getDb()
|
|
||||||
{
|
|
||||||
$model = get_called_class();
|
|
||||||
if (!isset(self::$links[$model])) {
|
|
||||||
self::$links[$model] = (new static())->db();
|
|
||||||
}
|
|
||||||
return self::$links[$model];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改器 设置数据对象的值
|
* 修改器 设置数据对象的值
|
||||||
* @access public
|
* @access public
|
||||||
|
|||||||
Reference in New Issue
Block a user