@if ($result['pages'] > 1) @php $cur = $result['page']; $last = $result['pages']; // 1 … 4 5 [6] 7 8 … 20 : first, last and two either side of the current page $nums = collect(range(1, $last))->filter(fn ($i) => $i === 1 || $i === $last || abs($i - $cur) <= 2)->values(); $param = $param ?? 'page'; $anchor = $anchor ?? ''; $btn = 'flex h-11 min-w-[44px] items-center justify-center rounded-full px-3 text-sm font-bold'; @endphp @endif