options['user_id'])) { throw new BadRequestException(); } $user = $this->classMapper->staticMethod('user', 'find', $this->options['user_id']); // If the user doesn't exist, return 404 if (!$user) { throw new NotFoundException; } // Get user permissions $query = $user->permissions()->withVia('roles_via'); return $query; } }