@if ($paginator->hasPages())
@php
$page_min = max(1, $paginator->currentPage()-5);
$page_max = min($paginator->lastPage(), $paginator->currentPage()+5);
@endphp
<div class="pages">
@if($paginator->currentPage() > $page_min)
@php
$page_i = $paginator->currentPage()-1;
@endphp
<a href="{ $paginator->previousPageUrl() }" class="page_pre ">« 上一页</a>
@if($page_min > 1)
@php
$page_i = 1;
@endphp
<a href="{$paginator->url(1)}">1...</a>
@endif
@for($page_i = $page_min; $page_i < $paginator->currentPage(); $page_i++)
<a href="{$paginator->url($page_i)}">{$page_i}</a>
@endfor
@endif
<strong>{$paginator->currentPage()}</strong>
@if($paginator->currentPage() < $page_max)
@for($page_i = $paginator->currentPage()+1; $page_i <= $page_max; $page_i++)
<a href="{$paginator->url($page_i)}">{$page_i}</a>
@endfor
@if ($page_max < $paginator->lastPage())
@php
$page_i = $paginator->lastPage();
@endphp
<a href="{$paginator->url($page_i)}">...{$paginator->lastPage()}</a>
@endif
@php
$page_i = $paginator->currentPage()+1;
@endphp
<a href="{ $paginator->nextPageUrl() }" class="page_next">下一页 »</a>
@endif
</div>
@endif
写了一个分页 看起来总感觉好复杂 看起好累 求简化