📜  Laravel 自定义分页 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:13.398000             🧑  作者: Mango

代码示例6


@if ($paginator->lastPage() > 1)
    
  • First
  • @for ($i = 1; $i <= $paginator->lastPage(); $i++) currentPage() - $half_total_links; $to = $paginator->currentPage() + $half_total_links; if ($paginator->currentPage() < $half_total_links) { $to += $half_total_links - $paginator->currentPage(); } if ($paginator->lastPage() - $paginator->currentPage() < $half_total_links) { $from -= $half_total_links - ($paginator->lastPage() - $paginator->currentPage()) - 1; } ?> @if ($from < $i && $i < $to)
  • {{ $i }}
  • @endif @endfor
  • Last
@endif