Vinay
Vinay

Reputation: 21

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?

Upvotes: 2

Views: 1284

Answers (1)

ThS
ThS

Reputation: 4783

You can call withQueryString method on the paginator instance.

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

That method is only available as of Laravel 7.

Upvotes: 1

Related Questions