From 4c05fdc15bdadf0182a70e4564bf0c2e6086b782 Mon Sep 17 00:00:00 2001 From: jiannei Date: Mon, 16 Oct 2023 10:20:03 +0800 Subject: [PATCH] fix: resource collection --- src/Support/Format.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Support/Format.php b/src/Support/Format.php index 88a1bf9..d5f106f 100644 --- a/src/Support/Format.php +++ b/src/Support/Format.php @@ -95,10 +95,10 @@ public function paginator(AbstractPaginator|AbstractCursorPaginator|Paginator $r */ public function resourceCollection(ResourceCollection $collection): array { - return array_filter([ + return [ 'data' => $collection->resolve(), 'meta' => $this->formatMeta($collection->resource), - ]); + ]; } /** @@ -182,6 +182,7 @@ protected function formatJsonResource(): \Closure */ protected function formatMeta($collection): array { + // vendor/laravel/framework/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php return match (true) { $collection instanceof CursorPaginator => [ 'cursor' => [