diff --git a/src/Resolvers/TransformedDataCollectableResolver.php b/src/Resolvers/TransformedDataCollectableResolver.php index ebcd53f7..f4e098cc 100644 --- a/src/Resolvers/TransformedDataCollectableResolver.php +++ b/src/Resolvers/TransformedDataCollectableResolver.php @@ -89,10 +89,8 @@ protected function transformPaginator( Wrap $wrap, TransformationContext $nestedContext, ): array { - $items = array_map(fn (BaseData $data) => $this->transformationClosure($nestedContext)($data), $paginator->items()); - if ($nestedContext->transformValues === false) { - return $items; + return $paginator->map(fn (BaseData $data) => $this->transformationClosure($nestedContext)($data))->all(); } $paginated = $paginator->toArray(); @@ -100,7 +98,7 @@ protected function transformPaginator( $wrapKey = $wrap->getKey() ?? 'data'; return [ - $wrapKey => $items, + $wrapKey => array_map(fn (BaseData $data) => $this->transformationClosure($nestedContext)($data), $paginator->items()), 'links' => $paginated['links'] ?? [], 'meta' => Arr::except($paginated, [ 'data',