@if ($paginator->hasPages())
    <ul class="pagination">
        {{-- Previous Page Link --}}
        @if ($paginator->onFirstPage())
            <li class="page-item previous disabled"><a href="#" class="page-link"><i class="previous"></i></a></li>
        @else
        <li class="page-item previous"><a href="{{ PaginateRoute::previousPageUrl() }}" class="page-link"><i class="previous"></i></a></li>
        @endif

        {{-- Pagination Elements --}}
        @foreach ($elements as $element)
            {{-- "Three Dots" Separator --}}
            @if (is_string($element))
                <li class="disabled page-item"><span class="page-link">{{ $element }}</span></li>
            @endif

            {{-- Array Of Links --}}
            @if (is_array($element))
                @foreach ($element as $page => $url)
                    @if ($page == $paginator->currentPage())
                        <li class="page-item active"><span class="page-link">{{ $page }}</span></li>
                    @else
                        @if (in_array($paginator->currentPage(), [$page - 1, $page, $page + 1]))
                            <li class="page-item"><a class="page-link" href="{{ PaginateRoute::pageUrl($page) }}">{{ $page }}</a></li>
                        @else
                            <li class="page-item hidden-xs"><a class="page-link" href="{{ PaginateRoute::pageUrl($page) }}">{{ $page }}</a></li>
                        @endif
                    @endif
                @endforeach
            @endif
        @endforeach

        {{-- Next Page Link --}}
        @if ($paginator->hasMorePages())
        <li class="page-item next"><a href="{{ PaginateRoute::nextPageUrl($paginator) }}" class="page-link"><i class="next"></i></a></li>
        @else
            <li class="page-item disabled"><span class="page-link">›</span></li>
        @endif
    </ul>
@endif
