art-es/laravel-pagination-buttons

从laravel框架中获取分页按钮的包

1.0.0 2019-08-19 08:44 UTC

This package is not auto-updated.

Last update: 2024-09-25 08:23:47 UTC


README

安装

composer require art-es/laravel-pagination-buttons

使用

获取分页按钮。

$buttons = \Artes\Pagination\Pagination::execute($pages, $currentPage);

currentPage 不是必需的参数,默认从请求中获取参数 page

回调是 \Illuminate\Support\Collection 对象。
它是一个可遍历的对象。

你可以使用

@foreach ($buttons as $button)
    <a href="{{ route('some.route', ['page' => $button->page]) }}"
        class="{{ $button->active ? 'active' : '' }}">
        {{ $button->label }}
    </a>
@endforeach

许可

MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件