'Laravel Pagination Remoing Get URL Parameters

I have a table users where I am getting user specefic data in table

abc.com?country=india&state=haryana

and I am using Laravel pagination

($user->links())

when I move to next page previous parameters are removing from the URL. The url only remaining with

abc.com?page=2

How to resolve this issue?



Solution 1:[1]

You can call withQueryString method on the paginator instance.

$users->withQueryString()->links()

That method is only available as of Laravel 7.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ths