Skip to content

Commit

Permalink
fix: resource collection
Browse files Browse the repository at this point in the history
  • Loading branch information
jiannei committed Oct 16, 2023
1 parent 4a43eee commit 4c05fdc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Support/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]);
];
}

/**
Expand Down Expand Up @@ -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' => [
Expand Down

0 comments on commit 4c05fdc

Please sign in to comment.