paginate.blade.php 2.23 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="10" height="17">
                    <use xlink:href="{{ asset('images/sprite.svg#slider-arrow')}}"></use>
                </svg>
            </a>
        @else
                <a class="pagination__btn pagination__btn-prev" href="{{ $paginator->previousPageUrl() }}">
                    <svg width="10" height="17">
                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow')}}"></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="10" height="17">
                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow')}}"></use>
                    </svg></a>
            @else
                <a class="pagination__btn pagination__btn-next disabled" href="#">
                    <svg width="10" height="17">
                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow')}}"></use>
                    </svg></a>
            @endif
        </div>
    </div>
@endif