Laravel 5 - Manual pagination

aBhijit picture aBhijit · Nov 30, 2014 · Viewed 20.7k times · Source

Pagination::make() method doesn't exist in Pagination class anymore in Laravel 5.

Is there a workaround to make manual pagination work in Laravel 5?

Answer

Marcin Nabiałek picture Marcin Nabiałek · Dec 18, 2014

You need to add use:

use Illuminate\Pagination\LengthAwarePaginator as Paginator;

and now you can use:

 $paginator = new Paginator($items, $count, $limit, $page, [
            'path'  => $this->request->url(),
            'query' => $this->request->query(),
        ]);

to get data in the same format as paginating on model object;