Laravel 5 Pagination with array

Laravel provides pagination for Eloquent results out of the box, but for custom data we need to do the pagination manually.

In this tutorial, I’ll use Laravel5 LengthAwarePaginator class to show you how you can create a paginated list of results from a array of data.

Here is the Script –

Controller – app/Http/Controller/ItemsController.php

Here is the view file

Define your route as shown below –

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.


I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.

  • Emilan Țŕœjån

    hey can u help me
    how array like this
    $data[‘a’]=DB::select(“select * from table_name);
    $data[‘b’]=DB::select(“select * from table_name);

    return view(‘view.home’,$data);
    how to add pagination like you do it Protection Status