ItSolutionStuff.com

Laravel 12 Pagination Add Query String Example

By Hardik Savani July 17, 2025
Laravel

In this post, i will show you how to automatically append query string with pagination in laravel 12 application.

Laravel makes it easy to add pagination using the `paginate()` method on a model. To show the pagination links, you can use the `links()` method. This works well for basic pagination.

However, if your page has filters (like showing only active users), you need to include the filter data in the pagination links. For example, to keep the pagination for only active users, you can add the "is_active" filter to the query string using the `appends()` method.

we will use appends() function to add automatically add query string to pagination url.

Let's see the example:

Query String URL:

http://localhost:8000/posts?is_active=1&page=1

Example:

we will use appends() method with request()->query() method to pass query string.

{{ $posts->appends(request()->query())->links('pagination::bootstrap-5') }}

I hope it can help you...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy