Repository navigation
[5.3] LengthAwarePaginator custom pageName and currentPage - #15870
Conversation
Ran into minor problem using multiple LengthAwarePaginators on a single page with alternate 'pageName' properties. Traced problem to the attached proposed change. When checking the current page for a LengthAwarePaginator instance, any non-default pageName is not sent to resolveCurrentPage and as such 1 is always returned (unless pageName of 'page' is used).
|
Hello @jivemonkey2000, can you please provide more details about this issue? How can I replicate it in a fresh laravel 5.3 installation? |
|
ping @jivemonkey2000 |
|
Hi @themsaid, sorry, only just got a notification of reply. Add the following to the base use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
$collection = collect(['this','is','a','collection','of','items']);
$pageName = 'foo';
$perPage = '5';
$path = '/';
$paginator = new LengthAwarePaginator(
$collection->forPage(Paginator::resolveCurrentPage($pageName),$perPage),
$collection->count(),
$perPage,
null,
["path"=>$path, 'pageName' => $pageName]
);
dd($paginator);Then, navigate to The current page is returning 1, even though the I also believe this may also be applicable to Thanks. Edit: Just to mention, on implementing my fork locally the correct current page is returned. |
|
Thanks. |
|
You're welcome. Keep up the great work. |
Ran into minor problem using multiple LengthAwarePaginators on a single page with alternate 'pageName' properties. Traced problem to the attached proposed change. When checking the current page for a LengthAwarePaginator instance, any non-default pageName is not sent to resolveCurrentPage and as such 1 is always returned (unless pageName of 'page' is used).
Hi there.
New to Laravel, 3 weeks in and absolutely love it.
Ran into minor problem using multiple
LengthAwarePaginators on a single page with alternatepageNameproperties. Traced problem to the attached proposed change.When checking the current page for a
LengthAwarePaginatorinstance, any non-defaultpageNameis not sent toresolveCurrentPageand as such 1 is always returned (unlesspageNameof 'page' is used.Andrew