Merge commit 'acd428f57bceb73ddc770cc6b59f8be7a237af90'
This commit is contained in:
@@ -53,6 +53,6 @@ class Role extends Model
|
||||
// 角色拥有的资源(权限点、菜单)
|
||||
public function resources()
|
||||
{
|
||||
return $this->belongsToMany(Resource::class, 'role_resources', 'role_id', 'resource_id');
|
||||
return $this->belongsToMany(Resource::class, 'role_resources', 'role_id', 'resource_id')->orderBy('sort', 'asc');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class User extends Model
|
||||
// 用户直接拥有的资源(用于特殊补权)
|
||||
public function resources()
|
||||
{
|
||||
return $this->belongsToMany(Resource::class, 'user_resources', 'user_id', 'resource_id');
|
||||
return $this->belongsToMany(Resource::class, 'user_resources', 'user_id', 'resource_id')->orderBy('sort', 'asc');
|
||||
}
|
||||
|
||||
// 用户可访问的系统
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
/**
|
||||
* user_roles 用户-角色关联
|
||||
* @property integer $user_id 用户ID(主键)
|
||||
* @property integer $role_id 角色ID(主键)
|
||||
*/
|
||||
class UserRoles extends Model
|
||||
{
|
||||
/**
|
||||
* The connection name for the model.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $connection = 'mysql';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'user_roles';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = null;
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'role_id'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
/**
|
||||
* user_systems 用户-系统关联表:描述用户可访问哪些系统
|
||||
* @property integer $user_id 用户ID(主键)
|
||||
* @property integer $system_id 系统ID(主键)
|
||||
* @property integer $created_at 创建时间
|
||||
*/
|
||||
class UserSystems extends Model
|
||||
{
|
||||
/**
|
||||
* The connection name for the model.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $connection = 'mysql';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'user_systems';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = null;
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
// protected $dateFormat = 'U';
|
||||
|
||||
// const UPDATED_AT = false;
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'system_id',
|
||||
'created_at'
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user