Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vtxmg's avatar

Two Pagination on same page

Hello guys.. I have two pagination in a same page !! Now I want to make both functional without affecting one another. You know that by default it use ?page=1 in url to paginate but when it did it affect another too.. so whats the solution?

0 likes
3 replies
pmall's avatar
pmall
Best Answer
Level 56
$paginator1 = Model1::where(...)->paginate();
$paginator2 = Model1::where(...)->paginate();
$paginator1->setPageName('foo');
$paginator2->setPageName('bar');

But I'm really not sure this is a good design to have two paginators for one page.

1 like
vtxmg's avatar

It set the page name but didn't paginate the page !! :(

ounos's avatar

I can also confirm this. Although the page name is set correctly, it does not work, clicking on a page number does nothing.

Please or to participate in this conversation.