PamRole
class PamRole extends Model implements RbacRoleContract mixin Eloquent
用户角色
Traits
角色 Trait
Constants
BE_ROOT |
|
FE_USER |
|
Properties
$timestamps | |||
protected | $table | ||
protected | $fillable | ||
int | $id | ID | |
string | $name | 标识 | |
string | $title | 角色名称 | |
string | $description | 描述 | |
string | $type | 角色组 | |
bool | $is_system | 是否系统 | |
int | $is_enable | 是否可用 | |
Collection|PamPermission[] read-only | $perms | ||
Collection|PamAccount[] read-only | $users |
Methods
bool
hasPermission(string|array $name, bool $require_all = false)
Checks if the role has a permission by its name.
from
RbacRoleTrait
static mixed
getAccountTypeByRoleId(int $role_id)
通过角色来获取账户类型, 由于角色在单条处理中不会存在变化, 故而可以进行静态缓存
static Collection
getLinear(null|string $type = null, string $key = 'id')
返回一维的角色对应
static array
getAll(string|null $accountType = null, bool $cache = true)
根据账户类型获取角色
static null
info(int $id, null $key = null, bool $cache = true)
获取角色信息
Details
in
RbacRoleTrait at line 23
Collection|mixed
cachedPermissions()
No description
in
RbacRoleTrait at line 34
static void
boot()
No description
in
RbacRoleTrait at line 69
flushPermissionRole()
清理权限
in
RbacRoleTrait at line 77
BelongsToMany
users()
No description
in
RbacRoleTrait at line 96
BelongsToMany
perms()
Many-to-Many relations with the permission model.
Named "perms" for backwards compatibility. Also, because "perms" is short and sweet.
in
RbacRoleTrait at line 112
void
savePermissions($permissions)
No description
in
RbacRoleTrait at line 120
void
syncPermission($id)
No description
in
RbacRoleTrait at line 133
void
attachPermission(object|array|Permission $id)
给角色添加权限, 并且清空角色缓存
in
RbacRoleTrait at line 154
void
detachPermission(object|array $id)
Detach permission from current role.
in
RbacRoleTrait at line 173
void
attachPermissions(array $permissions)
No description
in
RbacRoleTrait at line 183
void
detachPermissions(array $permissions)
No description
in
RbacRoleTrait at line 196
bool
hasPermission(string|array $name, bool $require_all = false)
Checks if the role has a permission by its name.
in
RbacRoleTrait at line 226
static protected void
clearCachedPermissions()
No description
in
RbacRoleTrait at line 231
static protected void
clearCachedPivotPermissions($role_id)
No description
at line 50
static mixed
getAccountTypeByRoleId(int $role_id)
通过角色来获取账户类型, 由于角色在单条处理中不会存在变化, 故而可以进行静态缓存
at line 66
static Collection
getLinear(null|string $type = null, string $key = 'id')
返回一维的角色对应
at line 77
static array
getAll(string|null $accountType = null, bool $cache = true)
根据账户类型获取角色
at line 100
static null
info(int $id, null $key = null, bool $cache = true)
获取角色信息