We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b1916f2 commit 8e84c63Copy full SHA for 8e84c63
1 file changed
src/Traits/User.php
@@ -104,14 +104,19 @@ public function isSuper()
104
* @return void
105
*/
106
public function getAllPermissions(): Collection
107
- {
+ {
108
+ // 超级管理员 默认全部规则
109
+ if ($this->isSuper()) {
110
+ return Permission::select();
111
+ }
112
+
113
$permissions = [];
114
115
foreach ($this->roles as $role) {
116
$permissions = array_unique(array_merge($permissions, $role->permissions->column('name')));
117
}
118
119
$permissions = Permission::whereIn('name', implode(',', $permissions))->select();
-
120
return $permissions;
121
122
0 commit comments