Join my Laravel for REST API's course on Udemy 👀

Use Bootstrap for pagination links in Laravel

July 29, 2022  ‐ 1 min read

Before Laravel V8 the pagination links were by default styled using Bootstrap. But since Laravel version 8 this default changed to Tailwind CSS. If you not already upgraded to version 8 this might be something to pay attention to.

Anyway, if you prefer to you can still make use of Bootstrap styling for pagination links. We need to make a change to the AppServiceProvider for this.

For Laravel 9

For Laravel v9 we can choose the Bootstrap version. In the boot() method we can call either the useBootstrapFive() or useBootstrapFour() method.

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Pagination\Paginator;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        // For Bootstrap v5
        Paginator::useBootstrapFive();

        // For Bootstrap v4
        Paginator::useBootstrapFour();
    }
}

For Laravel 8

For Laravel v8, in the boot() method call useBootstrap() to make use of Bootstrap styled pagination views.

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Pagination\Paginator;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Paginator::useBootstrap();
    }
}