Skip to content

Commit 41f8437

Browse files
committed
Adding indexCollection interceptor.
1 parent 5a5cb16 commit 41f8437

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Repositories/Repository.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,12 +602,13 @@ public function index(RestifyRequest $request)
602602
$request, $items->map(fn (self $repository) => $repository->resource), RepositoryCollection::meta($paginator->toArray())
603603
) ?? RepositoryCollection::meta($paginator->toArray()),
604604
'links' => RepositoryCollection::paginationLinks($paginator->toArray()),
605-
'data' => $items->map(fn (self $repository) => $repository->serializeForIndex($request)),
605+
'data' => $this->indexCollection($request, $items)->map(fn (self $repository) => $repository->serializeForIndex($request)),
606606
]);
607607
}
608608

609-
public function indexPaginator(RestifyRequest $request)
609+
public function indexCollection(RestifyRequest $request, Collection $items): Collection
610610
{
611+
return $items;
611612
}
612613

613614
public function resolveIndexMainMeta(RestifyRequest $request, Collection $items, array $paginationMeta): array

0 commit comments

Comments
 (0)