forked from lunarphp/livewire-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue lunarphp#80,lunarphp#81: Added pagination and optimize the …
…query.
- Loading branch information
Showing
4 changed files
with
66 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@if ($paginator->hasPages()) | ||
<nav aria-label="Page navigation example" class="text-center"> | ||
<ul class="inline-flex -space-x-px max-w-screen-xl px-2 py-12 mx-auto center "> | ||
{{-- Previous Page Link --}} | ||
@if ($paginator->onFirstPage()) | ||
<li> | ||
<span class="flex items-center justify-center px-3 h-8 ms-0 leading-tight text-gray-500 bg-white border border-e-0 border-gray-300 rounded-s-lg cursor-not-allowed">Previous</span> | ||
</li> | ||
@else | ||
<li> | ||
<a href="{{ $paginator->previousPageUrl() }}" class="flex items-center justify-center px-3 h-8 ms-0 leading-tight text-gray-500 bg-white border border-e-0 border-gray-300 rounded-s-lg hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">Previous</a> | ||
</li> | ||
@endif | ||
|
||
{{-- Pagination Elements --}} | ||
@foreach ($elements as $element) | ||
{{-- "Three Dots" Separator --}} | ||
@if (is_string($element)) | ||
<li> | ||
<span class="flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 cursor-not-allowed">{{ $element }}</span> | ||
</li> | ||
@endif | ||
|
||
{{-- Array Of Links --}} | ||
@if (is_array($element)) | ||
@foreach ($element as $page => $url) | ||
@if ($page == $paginator->currentPage()) | ||
<li> | ||
<span class="flex items-center justify-center px-3 h-8 text-blue-600 border border-gray-300 bg-blue-50 cursor-not-allowed">{{ $page }}</span> | ||
</li> | ||
@else | ||
<li> | ||
<a href="{{ $url }}" class="flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">{{ $page }}</a> | ||
</li> | ||
@endif | ||
@endforeach | ||
@endif | ||
@endforeach | ||
|
||
{{-- Next Page Link --}} | ||
@if ($paginator->hasMorePages()) | ||
<li> | ||
<a href="{{ $paginator->nextPageUrl() }}" class="flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">Next</a> | ||
</li> | ||
@else | ||
<li> | ||
<span class="flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg cursor-not-allowed">Next</span> | ||
</li> | ||
@endif | ||
</ul> | ||
</nav> | ||
@endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters