How to Add Query String Automatically on Laravel Pagination Links?

How to Add Query String Automatically on Laravel Pagination Links?

In this post we will give you information about How to Add Query String Automatically on Laravel Pagination Links?. Hear we will give you detail about How to Add Query String Automatically on Laravel Pagination Links?And how to use it also give you demo for it if it is necessary.

For example you are working on items module and you have a index page like listing all items with pagination. also you did give search function on items name. I have a bellow query string when i search something and i want to pass that query string on all pagination link.

Query String URL:

But where is problem. when you search any for example “tes” and get the result but when you click on next page you can’t filter on name as you did “tes”. so at that time we have to appends that query string on pagination links. so, let’s see how to solve this issue.

View Example:

Also see:Laravel 5 – elasticsearch with pagination example

{!! $products->appends(Input::all())->render() !!}

We have to just add appends method of pagination and give array as argument. Input::all() will be get whole query string from url and pass with pagination.

Hope this code and post will helped you for implement How to Add Query String Automatically on Laravel Pagination Links?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

5  +  1  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US