Initial commit
This commit is contained in:
40
resources/views/custom-pagination.blade.php
Normal file
40
resources/views/custom-pagination.blade.php
Normal file
@@ -0,0 +1,40 @@
|
||||
@if ($paginator->hasPages())
|
||||
<nav class="mt-6">
|
||||
<ul class="pagination flex gap-4">
|
||||
@if ($paginator->onFirstPage())
|
||||
<li class="disabled"><span>«</span></li>
|
||||
@else
|
||||
<li><a href="{{ route('CategoryBlog', ['slug' => $slug, 'page' => $paginator->currentPage() - 1]) }}"
|
||||
rel="prev">«</a></li>
|
||||
@endif
|
||||
@foreach ($paginator->links()->elements as $element)
|
||||
@if (is_string($element))
|
||||
<li class="disabled"><span>{{ $element }}</span></li>
|
||||
@endif
|
||||
|
||||
@if (is_array($element))
|
||||
@foreach ($element as $page => $url)
|
||||
@if ($page == $paginator->currentPage())
|
||||
<li class="active"><span>{{ $page }}</span></li>
|
||||
@elseif(
|
||||
$page == 1 ||
|
||||
$page == $paginator->lastPage() ||
|
||||
($page >= $paginator->currentPage() - 1 && $page <= $paginator->currentPage() + 1))
|
||||
<li><a
|
||||
href="{{ route('CategoryBlog', ['slug' => $slug, 'page' => $page]) }}">{{ $page }}</a>
|
||||
</li>
|
||||
@elseif($page == 2 || $page == $paginator->lastPage() - 1)
|
||||
<li class="disabled"><span>...</span></li>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@if ($paginator->hasMorePages())
|
||||
<li><a href="{{ route('CategoryBlog', ['slug' => $slug, 'page' => $paginator->currentPage() + 1]) }}" rel="next">»</a></li>
|
||||
@else
|
||||
<li class="disabled"><span>»</span></li>
|
||||
@endif
|
||||
</ul>
|
||||
</nav>
|
||||
@endif
|
||||
Reference in New Issue
Block a user