Laravel Pagination Remoing Get URL Parameters

Viewed 124

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?

1 Answers

You can call withQueryString method on the paginator instance.

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

That method is only available as of Laravel 7.

Related