I\'m having some trouble with my pagination. I\'m having two tables with data from a database and I paginated it with laravel Paginator.
Now my problem is when you g
This is an easy solution I've found on Laravel 4.
Controller
Change the page name before you make the paginator:
Paginator::setPageName('page_a');
$collection_A = ModelA::paginate(10);
Paginator::setPageName('page_b');
$collection_B = ModelB::paginate(10);
View
Do the same: change the page name before you print the links
Paginator::setPageName('page_a');
$collection_A->links();
Paginator::setPageName('page_b');
$collection_B->links();
If you don't want to lose any page state while you navigate to another page, append to the links the current page from all collections:
Paginator::setPageName('page_a');
$collection_A->appends('page_b', Input::get('page_b',1))->links();
Paginator::setPageName('page_b');
$collection_B->appends('page_a', Input::get('page_a',1))->links();