Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

thebigk's avatar
Level 13

Why is my GET parameter 's' being replaced with 'query' in pagination?

I've a search box that makes a GET request through my /search/ route with parameter named s . So I've search urls like /search/?s=keyword1+keyword2.

The problem happens when the results are paginated. I'm getting following pagination URLs

/search?query=keyword1+keyword2&page=2

I've no clue why is my s parameter is getting replaced by query parameter. Does anyone have a clue about this?

0 likes
1 reply
jlrdw's avatar

Did you correctly append your parameters,

From docs, quote

Appending To Pagination Links You may append to the query string of pagination links using the appends method. For example, to append sort=votes to each pagination link, you should make the following call to appends:

{{ $users->appends(['sort' => 'votes'])->links() }}

If you wish to append a "hash fragment" to the paginator's URLs, you may use the fragment method. For example, to append #foo to the end of each pagination link, make the following call to the fragment method:


{{ $users->fragment('foo')->links() }}

End quote

I usually formulate the array in the controller and pass it to the view using a with statement.

And I am so sorry if I misunderstood your question in any possible way. I just hope my answer has something to do with your question.

Please or to participate in this conversation.