getUser($request); if (!Authority::canIndexUnits($user)) { throw new AuthorizationFailedException(); } list($offset, $limit) = $this->getOffsetAndLimit(); $resources = Unit::findBySQL('1 ORDER BY mkdate LIMIT ? OFFSET ?', [$limit, $offset]); return $this->getPaginatedContentResponse($resources, count($resources)); } }