public function discover() { $resource = new Resource(); $resource->addLink(RestLinker::createLinkToFirstPage('users')); // viewing the list of roles should be only allowed for admins if ($this->authorizationService->hasRoles(['ADMIN'])) { $resource->addLink(RestLinker::createLink('roles')); } // etc... return RestResponse::sendResource($resource); }
/** * Adds a single Link to the Resource under generation. As a reminder: Links are plain arrays. * * @param array $link * @return RestExt */ public function addLink(array $link) { $this->resource->addLink($link); return $this; }