Limit amount of links shown with Laravel pagination

前端 未结 11 2182
一个人的身影
一个人的身影 2020-12-14 02:10

Any easy way to limit how many links are shown with Laravels pagination?

Currently it shows 13 links at most (Prev, 1 2 3 4 5 7 8 .. 78 79 next)

This however

11条回答
  •  [愿得一人]
    2020-12-14 02:16

    For Laravel 5.6+

    Publish vendor template:

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

    Edit bootstrap-4.blade.php as following:

    @if ($paginator->hasPages())
    
    @endif
    

    This example handle in a correct way new CSS classes, active link, three dots (correctly, not 1..2 3 4) and is it customizable (number of pages that you want to show).

    Example

    Three dots handled correctly

提交回复
热议问题