mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 15:02:47 +08:00
修正
This commit is contained in:
@@ -1475,16 +1475,17 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string|array|\Closure $name 命名范围名称 逗号分隔
|
* @param string|array|\Closure $name 命名范围名称 逗号分隔
|
||||||
* @internal mixed ...$params 参数调用
|
* @internal mixed ...$params 参数调用
|
||||||
* @return Model|Query
|
* @return Query
|
||||||
*/
|
*/
|
||||||
public static function scope($name)
|
public static function scope($name)
|
||||||
{
|
{
|
||||||
if ($name instanceof Query) {
|
if ($name instanceof Query) {
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
$model = new static();
|
$model = new static();
|
||||||
$params = func_get_args();
|
$query = $model->db();
|
||||||
$params[0] = $model->getQuery();
|
$params = func_get_args();
|
||||||
|
array_unshift($params, $query);
|
||||||
if ($name instanceof \Closure) {
|
if ($name instanceof \Closure) {
|
||||||
call_user_func_array($name, $params);
|
call_user_func_array($name, $params);
|
||||||
} elseif (is_string($name)) {
|
} elseif (is_string($name)) {
|
||||||
@@ -1498,7 +1499,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $model;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1885,7 +1886,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
public static function __callStatic($method, $args)
|
public static function __callStatic($method, $args)
|
||||||
{
|
{
|
||||||
$model = new static();
|
$model = new static();
|
||||||
$query = $model->db(true, false);
|
$query = $model->db();
|
||||||
|
|
||||||
if (method_exists($model, 'scope' . $method)) {
|
if (method_exists($model, 'scope' . $method)) {
|
||||||
// 动态调用命名范围
|
// 动态调用命名范围
|
||||||
|
|||||||
Reference in New Issue
Block a user