Adeva< 5-minute read

Laravel: Overwriting the Default Pagination System

Explore each different Laravel custom pagination example and learn how to implement pagination while customizing it to fit your application’s needs.

Last updated: May 26, 2026

Explore each different Laravel custom pagination example and learn how to implement pagination while customizing it to fit your application’s needs.

Last updated: May 26, 2026
Ivica Jangelovski

Ivica Jangelovski

PHP Developer

Ivica has over six years of experience as a full-stack PHP developer. Always up for a challenge, he has worked with leading New York and London digital agencies across different industries. A fast learner and great team player, he’s always willing to go beyond expectations to achieve a deadline or step up for the team.

Share

Explore each different Laravel custom pagination example and learn how to implement pagination while customizing it to fit your application’s needs.

Laravel is the most widely used framework in the PHP developer community. It comes with many out-of-the-box features that allow every Laravel developer to accelerate the application development process.

Some of the best features include:

  • Security and Authentication Implementation
  • Validation of the HTTP Requests
  • Database Migration System
  • CLI with Artisan
  • Templating Engine (Blade)
  • Pagination

Laravel’s flexibility is one of the main reasons it’s so attractive to developers. Almost all features are highly customizable and can be adjusted to fit your needs for different scenarios and requirements.

In this article we’ll explore pagination with Laravel. I believe it’s one of the best out-of-the-box Laravel features, and you can use it with just a few lines of code.

Table of Contents

Types of Laravel Paginations

There are two types of pagination methods currently supported by default for the Query Builder results and the Eloquent ORM queries. They include:

  • simplePaginate()
  • paginate()

The difference between them is that the first one displays only the Prev and Next buttons for navigating through the results, while the second one also includes the page numbers in between.

If you want to manually create a pagination system for results outside of Query Builder and the Eloquent ORM, have a look at this Laravel Manual Pagination example.

Controller Example Method

<?php


namespace App\Http\Controllers;


use App\Http\Controllers\Controller;

use Illuminate\Support\Facades\DB;

use App\Invoice;


class InvoicesController extends Controller

{

    public function index()

    {

        //We will place the results fetch in this method

    }

}

Assuming you have created a view index directory for the Invoices in views/invoices we’ll fetch the results in the index method and send them to the blade view.

Paginating Query Builder Results

Using the paginate() method:


public function index()

{

    $invoices = DB::table('invoices')->paginate(10);

   

    return view('invoices.index', ['invoices' => $invoices]);

}

Using the simplePaginate() method:


public function index()

{

    $invoices = DB::table('invoices')->simplePaginate(10);

   

    return view('invoices.index', ['invoices' => $invoices]);

}

Paginating Eloquent Results

Using the paginate() method:

$invoices = App\Invoice::paginate(10);

Using the simplePaginate() method:

$invoices = App\Invoice::simplePaginate(10);

An important thing to note is that the paginate() and simplePaginate() methods should be called after all the operations and constraints you made over the query.

How to Render Pagination Results in a Laravel View

By default, only a single line of code is required in the view. To display the HTML generated by the pagination methods, add the following:

{{ $invoices->links() }}

You may wrap this in nested HTML or place it wherever you want in your Laravel pagination Blade view. If you used the paginate() method, you’ll see that the custom pagination is rendered with links (or a combination of numbers + navigation buttons).

Customizing the Laravel Pagination HTML

The default Laravel installation is shipped with BootstrapCSS as a primary Laravel pagination CSS framework, meaning the HTML generated for the pagination is Bootstrap compatible (as noted in the docs).

But not everyone wants to utilize this default behavior and Bootstrap generated HTML.

Some of you may want to use your custom HTML/CSS or any other CSS framework (like TailwindCSS).

This is why the Laravel core provides a convenient way to reuse the existing HTML pagination views by publishing them in your views folder, where they can be customized.

The path for the Laravel pagination view core is as follows:

/vendor/laravel/framework/src/Illuminate/Pagination/resources/views

Making changes in the Laravel core code is not recommended. You will need to “grab” this folder and copy it to your resources/views/vendor folder by running:


php artisan vendor:publish --tag=laravel-pagination

This command will automatically create the folder /resources/views/vendor/pagination.

When you open it, you’ll notice a few blade files. We need the file named resources/views/vendor/pagination/bootstrap-4.blade.php because this is the one used by the paginate() method.

If you want to customize Laravel pagination or modify the simplePaginate() method output, you’ll need to edit: resources/views/vendor/pagination/simple-bootstrap-4.blade.php.

Any changes made here will be reflected in the original view, allowing you to customize Laravel pagination to fit your needs.

Bonus Tips

A few additional customization options are available when working with pagination in Laravel. For example, you may want to remove the default generated files or assign a different view as the default pagination template

All of this can be configured through the AppServiceProvider by calling the new pagination views in the boot() method:


use Illuminate\Pagination\Paginator;


public function boot()

{

    Paginator::defaultView('your-pagination-view-name');


    Paginator::defaultSimpleView('your-pagination-view-name');

}

This will make your-pagination-view-name and your-pagination-view-name the default pagination views for paginate() and simplePaginate().

Another useful detail to know is that the Laravel Paginator class includes numerous methods for working with and customizing pagination in Laravel.

You can read more about Laravel pagination on the Laravel docs page.

FAQs

Q: How do you customize pagination in Laravel?

To customize pagination in Laravel, use the Paginator class. After retrieving your data, pass it to Paginator::make() along with your data array, total item count, and number of items per page. You can customize the view by publishing and modifying the default pagination views, which provide full control over both pagination logic and presentation.

World-class articles, delivered weekly.

By entering your email, you are agreeing to our privacy policy.

World-class articles, delivered weekly.

By entering your email, you are agreeing to our privacy policy.

Join the Toptal® community.