@if($paginator->lastPage() != 1)
    <ul class="pagination">
        <li><a href="{{ $paginator->previousPageUrl() }}" class="text-primary PrevPaginate text-primary">&lt;</a></li>
        @if ($paginator->lastPage() == 1 || $paginator->lastPage() == 2 || $paginator->lastPage() == 3  )
            <li><a class="text-primary {{$paginator->currentPage() == 1 ? 'isActive' : '' }}"
                   href="{{$paginator->url(1)}}">1</a></li>
            @if($paginator->lastPage() != 1)
                <li><a class="text-primary {{$paginator->currentPage() == 2 ? 'isActive' : '' }}"
                       href="{{$paginator->url(2)}}">2</a></li>
            @endif
            @if($paginator->lastPage() == 3)
                <li><a class="text-primary {{$paginator->currentPage() == 3 ? 'isActive' : '' }}"
                       href="{{$paginator->url(3)}}">3</a></li>
            @endif
            @if ($paginator->hasMorePages())
                <li><a href="{{ $paginator->nextPageUrl() }}" class="NextPaginate text-primary">></a></li>
            @endif

        @else
            @if ($paginator->currentPage() != 1 )
                <li><a class="text-primary" href="{{$paginator->url(1)}}">1</a></li>
            @endif
            @if ($elements)
                @if($paginator->currentPage() == ($paginator->lastPage())-1)
                    <li><a class="text-primary"
                           href="{{$paginator->url(($paginator->currentPage()) - 1)}}">{{ ($paginator->currentPage()) - 1 }}</a>
                    </li>
                @endif
                <li><a href="#" class="isActive">{{ $paginator->currentPage() }}</a></li>
                @if($paginator->nextPageUrl())
                    <li><a class="text-primary"
                           href="{{$paginator->nextPageUrl()}}">{{ ($paginator->currentPage()) + 1 }}</a></li>
                    @if($paginator->currentPage() != ($paginator->lastPage())-1 )
                        <li>
                            <a class="text-primary"
                               href="{{$paginator->url(($paginator->currentPage()) + 2)}}">{{ ($paginator->currentPage()) + 2 }}</a>
                        </li>
                    @endif
                @endif
                @if ($paginator->currentPage() == 1)
                    <li><a class="text-primary" href="{{$paginator->url(4)}}">4</a></li>
                @endif
            @endif

            {{-- Next Page Link --}}
            @if ($paginator->hasMorePages())
                <li><a href="{{ $paginator->nextPageUrl() }}" class="NextPaginate text-primary">></a></li>
            @endif

        @endif


    </ul>
    @if(auth()->check())
        @if(auth()->user()->role == 'ادمین')
            <p class="text-center">
                صفحه
                {{ $paginator->currentPage() }}
                از
                <a href="{{ $paginator->url($paginator->lastPage()) }}">{{$paginator->lastPage()}}</a>
                و کل آیتم ها :
                {{ $paginator->total() }}
            </p>
        @endif
    @endif
@endif
