You're in the wrong namespace i guess, it should be
\Illuminate\Pagination\Paginator::make(....
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I just tried to use the following code (just for testing):
$data = [
'items' => ['1'],
'totalItems' => 100,
'perPage' => 20,
'pagination' => null,
];
$data['pagination'] = \Paginator::make( $data['items'], $data['totalItems'], $data['perPage'] );
And I got this very simple and usually easy-to-fix error:
Class 'Paginator' not found
What else should I do?
A more advanced sample:
// Get all items you want
$items = Item::all();
// Get the current page from the url if it's not set default to 1
$page = Input::get('page', 1);
// Number of items per page
$perPage = 10;
// Start displaying items from this number;
$offSet = ($page * $perPage) - $perPage; // Start displaying items from this number
// Get only the items you need using array_slice (only get 10 items since that's what you need)
$itemsForCurrentPage = array_slice($items->toArray(), $offSet, $perPage, true);
// Return the paginator with only 10 items but with the count of all items and set the it on the correct page
return new LengthAwarePaginator($itemsForCurrentPage, count($items), $perPage, $page);
If you have something like filters on your site or other parameters in your url you will lose them when you start paginating, you fix this you by adding this:
return new LengthAwarePaginator($items, count($items), $perPage, $page, ['path' => Request::url(), 'query' => Request::query()]);
And you can just render the the pagination like this
{!! $items->render() !!}
Please or to participate in this conversation.