getUser($request), $user)) { throw new AuthorizationFailedException(); } $memberships = $user->course_memberships; $total = count($memberships); list($offset, $limit) = $this->getOffsetAndLimit(); return $this->getPaginatedContentResponse($memberships->limit($offset, $limit), $total); } }