vtxmg's avatar

Pagination Problem Again :D

I did this for two pagination on same page as @pmall said. Yes it set the page name but didn't work in real. In my controller:

$paginator1 = Model1::where(...)->paginate();
$paginator2 = Model1::where(...)->paginate();
$paginator1->setPageName('foo');
$paginator2->setPageName('bar');

In view:

{!! str_replace('/?', '?', $paginator1 ->appends(Request::input())->render()) !!}


{!! str_replace('/?', '?', $paginator12->appends(Request::input())->render()) !!}
0 likes
4 replies
vtxmg's avatar

When I click the pagination button, it doesn't paginate the page.. though the name comes in url like : localhost/abc/home?foo=1.

bestmomo's avatar

Look at this post. You need to override PaginationServiceProvider.

Something like that in provider :

Paginator::currentPageResolver(function()
{
    if($this->app['request']->has('foo'))
    {
        return $this->app['request']->input('foo');
    }
    return $this->app['request']->input('bar');
});
pmall's avatar

Anyway it is strange to have two pagination on the same page, try to redesign your page in a better way so you have only one paginator.

Please or to participate in this conversation.