src/ResourceFactory.php
protected function makeFromPaginator(Paginator $paginator):ResourceInterface
    {
        $resource = static::makeFromCollection($paginator->getCollection());

        if ($resource instanceof CollectionResource) {
            $queryParams = array_diff_key(app('request')->all(), array_flip(['page']));
            $paginator->appends($queryParams);

            $resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
        }

        return $resource;
    }
protected function makeFromPaginator(Paginator $paginator):ResourceInterface
    {
        $resource = static::makeFromCollection($paginator->getCollection());

        if ($resource instanceof CollectionResource) {
            $queryParams = array_diff_key(app('request')->all(), array_flip(['page']));
            $paginator->appends($queryParams);

            $resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
        }

        return $resource;
    }
protected function makeFromPaginator ( Paginator $ paginator ) : ResourceInterface { $ resource = static :: makeFromCollection ( $ paginator -> getCollection ( ) ) ; if ( $ resource instanceof CollectionResource ) { $ queryParams = array_diff_key ( app ( 'request' ) -> all ( ) , array_flip ( [ 'page' ] ) ) ; $ paginator -> appends ( $ queryParams ) ; $ resource -> setPaginator ( new IlluminatePaginatorAdapter ( $ paginator ) ) ; } return $ resource ; }
Make resource from an Eloquent paginator.

@param  \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator
@return \League\Fractal\Resource\ResourceInterface
Make resource from an Eloquent paginator .