更新至5.1.27LTS,编写权限,在添加用户时直接添加角色
This commit is contained in:
1 parent
378b60cbf6
commit
f4f4fe1d67
39 files changed
+535
-367
No files matched your search
@@ -124,6 +124,12 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
*/
|
||||
protected $defaultSoftDelete;
|
||||
|
||||
/**
|
||||
* 全局查询范围
|
||||
* @var array
|
||||
*/
|
||||
protected $globalScope = [];
|
||||
|
||||
/**
|
||||
* 架构函数
|
||||
* @access public
|
||||
@@ -272,7 +278,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 获取当前模型的数据库查询对象
|
||||
* @access public
|
||||
* @param bool $useBaseQuery 是否调用全局查询范围
|
||||
* @param bool|array $useBaseQuery 是否调用全局查询范围(或者指定查询范围名称)
|
||||
* @return Query
|
||||
*/
|
||||
public function db($useBaseQuery = true)
|
||||
@@ -289,10 +295,16 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
}
|
||||
|
||||
// 全局作用域
|
||||
if ($useBaseQuery && method_exists($this, 'base')) {
|
||||
if (true === $useBaseQuery && method_exists($this, 'base')) {
|
||||
call_user_func_array([$this, 'base'], [ & $query]);
|
||||
}
|
||||
|
||||
$globalScope = is_array($useBaseQuery) && $useBaseQuery ?: $this->globalScope;
|
||||
|
||||
if ($globalScope) {
|
||||
$query->scope($globalScope);
|
||||
}
|
||||
|
||||
// 返回当前模型的数据库查询对象
|
||||
return $query;
|
||||
}
|
||||
@@ -427,6 +439,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
|
||||
// 重新记录原始数据
|
||||
$this->origin = $this->data;
|
||||
$this->set = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1030,7 +1043,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 设置是否使用全局查询范围
|
||||
* @access public
|
||||
* @param bool $use 是否启用全局查询范围
|
||||
* @param bool|array $use 是否启用全局查询范围(或者用数组指定查询范围名称)
|
||||
* @return Query
|
||||
*/
|
||||
public static function useGlobalScope($use)
|
||||
|
||||
Reference in new issue
Block a user