@if($exams->onFirstPage())
@else
@endif
@php
$exams->appends(request()->all());
$currentPage = $exams->currentPage();
$lastPage = $exams->lastPage();
$onEachSide = 1;
$start = max(2, $currentPage - $onEachSide);
$end = min($lastPage - 1, $currentPage + $onEachSide);
@endphp
{{-- Page 1 --}}
@if($currentPage == 1)
1
@else
1
@endif
{{-- Start Ellipsis --}}
@if($start > 2)
...
@endif
{{-- Middle Pages --}}
@for($i = $start; $i <= $end; $i++)
@if($i == $currentPage)
{{ $i }}
@else
{{ $i }}
@endif
@endfor
{{-- End Ellipsis --}}
@if($end < $lastPage - 1)
...
@endif
{{-- Last Page --}}
@if($lastPage > 1)
@if($currentPage == $lastPage)
{{ $lastPage }}
@else
{{ $lastPage }}
@endif
@endif
@if($exams->hasMorePages())
@else
@endif