In this post, i will show you how to automatically Laravel 11 Pagination Add Query String in application. You Can Learn How to Add Watermark on Image Laravel 11
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. You Can Learn Laravel 11 + Vue 3 + TailwindCSS – Fullstack personal blog
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.
Let’s see the example:
we will use appends() function to add automatically add query string to pagination url.
Step For Laravel 11 Pagination Add Query String 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…
Pingback: Udemy - Laravel 9 E 10 Con MySql, PHP OOP E MVC | Get Paid Course & Resourses Free
Pingback: Robi 10 min School – চাকরী জীবনের প্রস্তুতি – Get Free Course
Pingback: How To Use Quill Rich Text Editor In Laravel 11 | DevScriptSchool.com