Laravel - Pagination - Customizing The Pagination View
By default, the views rendered to display the pagination links are compatible with the Tailwind CSS framework. However, if you are not using Tailwind, you are free to define your own views to render these links. When calling the links
method on a paginator instance, you may pass the view name as the first argument to the method:
{{ $paginator->links('view.name') }}
// Passing additional data to the view...
{{ $paginator->links('view.name', ['foo' => 'bar']) }}
However, the easiest way to customize the pagination views is by exporting them to your resources/views/vendor
directory using the vendor:publish
command:
php artisan vendor:publish --tag=laravel-pagination
This command will place the views in your application's resources/views/vendor/pagination
directory. The tailwind.blade.php
file within this directory corresponds to the default pagination view. You may edit this file to modify the pagination HTML.
If you would like to designate a different file as the default pagination view, you may invoke the paginator's defaultView
and defaultSimpleView
methods within the boot
method of your App\Providers\AppServiceProvider
class: