php - Custom Pagination for Laravel API -


i have pull report uses groupby() , not using paginate() method in laravel. have created 1 manual pagination, has following code :

public static function getpaginatedresults($results, request $request) {         $rows               = 2;         $currentpage        = lengthawarepaginator::resolvecurrentpage();         $collection         = new collection($results);         $currentpageresults = $collection->slice($currentpage * $rows, $rows)->all();          $paginatedresults   = new lengthawarepaginator(             $currentpageresults,             count($collection),             $rows,             ['path' => $request->url(), 'query' => $request->query()]);          return $paginatedresults;     } 

this working fine unless next , previous url. getting next url /?page=2 , not showing previous url. how can complete url here , attach query string url passing from , to date along url.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -