public function withPaginator(LengthAwarePaginator $paginator, $transformer, $resourceKey = null, $meta = [])
    {
        $queryParams = array_diff_key($_GET, array_flip(['page']));
        $paginator->appends($queryParams);
        
        $resource = new Collection($paginator->items(), $transformer, $resourceKey);
        $resource->setPaginator(new IlluminatePaginatorAdapter($paginator));

        foreach ($meta as $metaKey => $metaValue) {
            $resource->setMetaValue($metaKey, $metaValue);
        }

        $rootScope = $this->manager->createData($resource);

        return $this->withArray($rootScope->toArray());
    }
public function withPaginator(LengthAwarePaginator $paginator, $transformer, $resourceKey = null, $meta = [])
    {
        $queryParams = array_diff_key($_GET, array_flip(['page']));
        $paginator->appends($queryParams);
        
        $resource = new Collection($paginator->items(), $transformer, $resourceKey);
        $resource->setPaginator(new IlluminatePaginatorAdapter($paginator));

        foreach ($meta as $metaKey => $metaValue) {
            $resource->setMetaValue($metaKey, $metaValue);
        }

        $rootScope = $this->manager->createData($resource);

        return $this->withArray($rootScope->toArray());
    }
public function withPaginator ( LengthAwarePaginator $ paginator , $ transformer , $ resourceKey = null , $ meta = [ ] ) { $ queryParams = array_diff_key ( $ _GET , array_flip ( [ 'page' ] ) ) ; $ paginator -> appends ( $ queryParams ) ; $ resource = new Collection ( $ paginator -> items ( ) , $ transformer , $ resourceKey ) ; $ resource -> setPaginator ( new IlluminatePaginatorAdapter ( $ paginator ) ) ; foreach ( $ meta as $ metaKey => $ metaValue ) { $ resource -> setMetaValue ( $ metaKey , $ metaValue ) ; } $ rootScope = $ this -> manager -> createData ( $ resource ) ; return $ this -> withArray ( $ rootScope -> toArray ( ) ) ; }
Respond with a paginator, and a transformer.

@param LengthAwarePaginator $paginator
@param callable|\League\Fractal\TransformerAbstract $transformer
@param string $resourceKey
@param array $meta
@return ResponseFactory
Respond with a paginator and a transformer .