private function makeDocumentFromCollection(
        ResourceManager $resourceManager,
        string $resource,
        $result,
        Parameters $parameters,
        ApiRequestHandler $handler
    )
    {
        $document = new Document();
        $serializer = $resourceManager->resolveSerializer($resource);
        if ($handler instanceof ModifiesSerializer) {
            $serializer = $handler->modify($serializer);
        }
        $collection = new Collection($result, $serializer);
        if ($handler instanceof HasElementIncludes) {
            $handler->includes($collection);
        }

        $this->assignAndResolveIncludes($resourceManager, $resource, $collection, $parameters);
        $document->setData($collection);

        if ($handler instanceof HasDocumentMeta) {
            $handler->meta($document);
        }

        if (config('json-api.response.resources.links.self', false)) {
            $document->addLink('self', apiRoute($resource, null, request()->route('version')));
        }

        return $document;
    }
private function makeDocumentFromCollection(
        ResourceManager $resourceManager,
        string $resource,
        $result,
        Parameters $parameters,
        ApiRequestHandler $handler
    )
    {
        $document = new Document();
        $serializer = $resourceManager->resolveSerializer($resource);
        if ($handler instanceof ModifiesSerializer) {
            $serializer = $handler->modify($serializer);
        }
        $collection = new Collection($result, $serializer);
        if ($handler instanceof HasElementIncludes) {
            $handler->includes($collection);
        }

        $this->assignAndResolveIncludes($resourceManager, $resource, $collection, $parameters);
        $document->setData($collection);

        if ($handler instanceof HasDocumentMeta) {
            $handler->meta($document);
        }

        if (config('json-api.response.resources.links.self', false)) {
            $document->addLink('self', apiRoute($resource, null, request()->route('version')));
        }

        return $document;
    }
private function makeDocumentFromCollection ( ResourceManager $ resourceManager , string $ resource , $ result , Parameters $ parameters , ApiRequestHandler $ handler ) { $ document = new Document ( ) ; $ serializer = $ resourceManager -> resolveSerializer ( $ resource ) ; if ( $ handler instanceof ModifiesSerializer ) { $ serializer = $ handler -> modify ( $ serializer ) ; } $ collection = new Collection ( $ result , $ serializer ) ; if ( $ handler instanceof HasElementIncludes ) { $ handler -> includes ( $ collection ) ; } $ this -> assignAndResolveIncludes ( $ resourceManager , $ resource , $ collection , $ parameters ) ; $ document -> setData ( $ collection ) ; if ( $ handler instanceof HasDocumentMeta ) { $ handler -> meta ( $ document ) ; } if ( config ( 'json-api.response.resources.links.self' , false ) ) { $ document -> addLink ( 'self' , apiRoute ( $ resource , null , request ( ) -> route ( 'version' ) ) ) ; } return $ document ; }
makes a document from collection

@param ResourceManager $resourceManager
@param string $resource
@param mixed $result
@param Parameters $parameters
@param \Ipunkt\LaravelJsonApi\Contracts\RequestHandlers\ApiRequestHandler $handler
@return Document
makes a document from collection