public function getPermissionsByModule($name)
 {
     return Permission::where('module', strtolower($name))->get();
 }
Beispiel #2
0
 public function getPermissionsAttribute()
 {
     return Cache::remember('user-perms:' . $this->id, config('collejo.caching.user_permissions'), function () {
         return Permission::join('permission_role', 'permission_role.permission_id', '=', 'permissions.id')->join('roles', 'permission_role.role_id', '=', 'roles.id')->join('role_user', 'permission_role.role_id', '=', 'role_user.role_id')->where('role_user.user_id', $this->id)->get();
     });
 }