We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 35fdb5a commit 69edb92Copy full SHA for 69edb92
src/Repositories/Repository.php
@@ -521,9 +521,11 @@ public function resolveRelationships($request): array
521
$paginator = $this->resource->{$relation}()->take($request->input('relatablePerPage') ?? (static::$defaultRelatablePerPage ?? RestifySearchable::DEFAULT_RELATABLE_PER_PAGE))->get();
522
}
523
524
- $withs[$relation] = $paginator->map(fn (Model $item) => [
525
- 'attributes' => $item->toArray(),
526
- ]);
+ $withs[$relation] = $paginator instanceof Collection
+ ? $paginator->map(fn (Model $item) => [
+ 'attributes' => $item->toArray(),
527
+ ])
528
+ : $paginator->toArray();
529
530
531
});
0 commit comments