Hello everyone!
I desperately need help with some issue with i have, concerning multiple paginations (2 paginations) on one page and links of pagination are not working properly.
Situation is following:
I got eloquent object- i sort it and do some process, then i converit it to 2 separate collections- now i have two collections which i have transfered by "Lengthawarepaginator"- and added pagination name for each by method "setPageName()". (!!! I HAVE to do this by custom paginate, since i am working with those, so more specific eloquent query is out of question)
Everything is working perfectly- when i click on any paginate link of any of those 2 paginations- it shows proper paginated results for that pagination, simply perfect.
BUT- pagination links are not working in proper display- i.e. when i click on page 2,3,4 whatever- even i get displayed proper page of pagination- pagination link stays ALWAYS at number one- appearing like it is displaying page one of pagination (even displaying f.e. 2,3,4 whatever pagination page results)- simply- the pagination links dont follow appropriate pagination page shown. Plus, link for page 1 of pagination is not clickable at all.
Here is my controller code:
$currentPage=LengthAwarePaginator::resolveCurrentPage('popular')-1;
$perPage=10;
$currentPageBlogResults = $items1->slice($currentPage * $perPage, $perPage)->all();
$items1= new LengthAwarePaginator($currentPageBlogResults, count($items1), $perPage);
$items1->setPath('offers');
$items1->setPageName('popular');
$currentPage=LengthAwarePaginator::resolveCurrentPage('highlow')-1;
$perPage=10;
$currentPageBlogResults = $items2->slice($currentPage * $perPage, $perPage)->all();
$items2= new LengthAwarePaginator($currentPageBlogResults, count($items2), $perPage);
$items2->setPath('offers');
$items2->setPageName('highlow');
For the view:
I simply foreach the results of each and under each i simply echo pagination links like:
{{$items1->links() }} and {{$items2->links () }}
Any suggestions?
Im running desparate, since i see i have something missing and for past 24 hours i was just trying to sort this issue out, plus i am being pushed by deadline to deliver.
Any ideas highly appreciated and I am highly thankful for it.
Carpe diem.