How to create simple pagination in Laravel 6 Application

How to create simple pagination in Laravel 6 Application

In this tutorial, I would like to help you how to create simple pagination in laravel 6 application. I will write simple code of Laravel 6 pagination example and show you how to use in blade file with paginate() and link() function.

I will explain you how to set custom path with pagination, how to appends input parameter with pagination link etc.

We know pagination is a primary requirement of each and every project. So if you are beginner with laravel than you must know how to use pagination in Laravel 6 and what is other function that can use with Laravel 6 pagination.

In this example I will explain you from scratch how to working with Laravel pagination. So let's follow bellow tutorial for creating simple example of pagination with Laravel 6.

Step 1: Add Route

First thing is we put one route in one for list users with pagination. So simple add both routes in your route file.


Route::get('users', '[email protected]');

Step 2: Create Controller

Same things as above for route, here we will add one new method for route. index() will return users with pagination data, so let's add bellow:



namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\User;

class UserController extends Controller



     * Display a listing of the resource.


     * @return \Illuminate\Http\Response


    public function index()


        $data = User::paginate(10);

        return view('users',compact('data'));



Laravel 6 CRUD Application Tutorial

Step 3: Create Blade File

In this step, you need to create users blade file and put bellow code with links() so it will generate pagination automatically. So let's put it.




<table class="table table-bordered">




            <th width="300px;">Action</th>




        @if(!empty($data) && $data->count())

            @foreach($data as $key => $value)


                    <td>{{ $value->name }}</td>


                        <button class="btn btn-danger">Delete</button>






                <td colspan="10">There are no data.</td>





{!! $data->links() !!}


Now you can run and check this example. it is a very simple and basic example.

If you need advance used of pagination then you can see bellow how to use.

Pagination with appends parameter

{!! $data->appends(['sort' => 'votes'])->links() !!}

Pagination with appends request all parameters

{!! $data->appends(Request::all())->links() !!}

You can also see in advance details from here: Laravel 6 Pagination.

I hope it can help you....

laravel php web-development

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

PHP Web Application Development Company

As a top **PHP Web Application Development Company in USA**[]( ""), we at Data EximIT have...

PHP Website Development

Skenix Infotech is a leading PHP Web Development Company that helps companies get results with industry best practices. Get affordable PHP Development Services.

Laravel Development Company

Skenix Infotech is a top Laravel Website Development Company with Expert Laravel Developers that provides robust Laravel Development Services at fair costs.

Hire Dedicated PHP Developer

Looking to hire affordable yet experienced PHP developers? **[Hire Dedicated PHP Developer]( "Hire Dedicated PHP Developer")**, who can convert your idea to reality, within the stipulated...

Hire PHP Developer

Looking to develop a PHP based website from scratch or revamp your existing website? **[]( "")** has always been an industry leader for companies and business owners looking to hire...