DEV Community

Cover image for Laravel pagination with parameters on views
Gagang
Gagang

Posted on

1

Laravel pagination with parameters on views

Based on this documentation. https://laravel.com/docs/8.x/pagination#introduction

to make pagination in laravel views along with parameters. I use this script.

@php
$first = 0;
$end = 0;
@endphp
@foreach($datas as $key=> $data)
{{ $key+ $datas->firstItem() }}
@php
$first = $datas->firstItem();
$end = $key + $datas->firstItem();
@endphp
@endforeach
{!! $first !!} - {!! $end !!} From {!! $datas->total() !!} Data
{!! $datas->appends(request()->query())->links() !!}
view raw index.blade.php hosted with ❤ by GitHub

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more