paginate.blade.php 2.18 KB
@if ($paginator->hasPages())
    <div class="pagination">
        <div class="pagination__inner">
            @if ($paginator->onFirstPage())
                <a class="pagination__btn pagination__btn-prev disabled" href="#">
                    <svg width="16" height="8">
                        <use xlink:href="{{ asset('/img/icons.svg#pag-prev')}}"></use>
                    </svg>
                </a>
            @else
                <a class="pagination__btn pagination__btn-prev" href="{{ $paginator->previousPageUrl() }}">
                    <svg width="16" height="8">
                        <use xlink:href="{{ asset('/img/icons.svg#pag-prev')}}"></use>
                    </svg>
                </a>
            @endif
            <ul class="pagination__list">
                @foreach ($elements as $element)
                    @if (is_string($element))

                        <li class="disabled pagination__item"><span>{{ $element }}</span></li>

                    @endif
                    @if (is_array($element))
                        @foreach ($element as $page => $url)
                            @if ($page == $paginator->currentPage())

                                <li class="pagination__item"><a class="pagination__link active">{{ $page }}</a></li>

                            @else

                                <li class="pagination__item"><a class="pagination__link" href="{{ $url }}">{{ $page }}</a></li>

                            @endif
                        @endforeach
                    @endif
                @endforeach

            </ul>
            @if ($paginator->hasMorePages())
                <a class="pagination__btn pagination__btn-next" href="{{ $paginator->nextPageUrl() }}">
                    <svg width="16" height="8">
                        <use xlink:href="{{ asset('/img/icons.svg#pag-next') }}"></use>
                    </svg></a>
            @else
                <a class="pagination__btn pagination__btn-next disabled" href="#">
                    <svg width="16" height="8">
                        <use xlink:href="{{ asset('/img/icons.svg#pag-next') }}"></use>
                    </svg></a>
            @endif
        </div>
    </div>
@endif