Skip to content

Commit b7bdecb

Browse files
committed
1.24.0
1 parent 0ca8605 commit b7bdecb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Contracts/Parser.php

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ trait Parser
1515
*/
1616
protected static $uriParser;
1717

18+
protected $originalQueryParams;
19+
1820
protected function getUriParser($request)
1921
{
2022
if (is_null(self::$uriParser)) {
@@ -32,6 +34,8 @@ protected function getUriParser($request)
3234
*/
3335
protected function addCustomParams($request, array $extraParams = []): void
3436
{
37+
$this->originalQueryParams = $request->query();
38+
3539
$all = $request->all();
3640
$new = Helpers::array_merge_request($all, $extraParams);
3741
$request->replace($new);

src/Http/Api/Controller.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function handleIndexAction($request, array $extraParams = [])
8484
$fields = $this->parseFieldParams();
8585
$limit = $this->parseLimitParams();
8686

87-
$items = $limit > 0 ? $this->repository->paginate($limit, $fields) : $this->repository->get($fields);
87+
$items = $limit > 0 ? $this->repository->paginate($limit, $fields)->appends($this->originalQueryParams) : $this->repository->get($fields);
8888

8989
return $this->handleIndexResponse($items);
9090
}
@@ -95,7 +95,7 @@ public function handleIndexActionRaw($request, array $extraParams = [])
9595
$fields = $this->parseFieldParams();
9696
$limit = $this->parseLimitParams();
9797

98-
$items = $limit > 0 ? $this->repository->paginateRaw($limit, $fields) : $this->repository->getRaw($fields);
98+
$items = $limit > 0 ? $this->repository->paginateRaw($limit, $fields)->appends($this->originalQueryParams) : $this->repository->getRaw($fields);
9999

100100
return $this->handleIndexResponse($items);
101101
}

0 commit comments

Comments
 (0)