Skip to content

Commit a797f1c

Browse files
committed
fix pagination
1 parent b465635 commit a797f1c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/Fields/Relation.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,14 @@ public function getPerPageKey(): string
615615
return sprintf('%s_per_page', $this->getRequestKey());
616616
}
617617

618+
/**
619+
* Get the page key.
620+
*/
621+
public function getPageKey(): string
622+
{
623+
return sprintf('%s_page', $this->getRequestKey());
624+
}
625+
618626
/**
619627
* Get the sort key.
620628
*/
@@ -657,10 +665,11 @@ public function paginate(Request $request, Model $model): LengthAwarePaginator
657665
->withCount($this->withCount)
658666
->latest()
659667
->paginate(
660-
$request->input(
668+
perPage: $request->input(
661669
$this->getPerPageKey(),
662670
$request->isTurboFrameRequest() ? 5 : $relation->getRelated()->getPerPage()
663-
)
671+
),
672+
pageName: $this->getPageKey()
664673
)->withQueryString();
665674
}
666675

src/Root.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Root
2727
*
2828
* @var string
2929
*/
30-
public const string VERSION = '2.7.19';
30+
public const string VERSION = '2.7.20';
3131

3232
/**
3333
* The registered booting callbacks.

0 commit comments

Comments
 (0)