reny410
353
2
Laravel

appending URL param for paging and searching

Posted 3 years ago by reny410

Hi guys, I have a page with paging and multiple kind of searching feature (search by categories, users, etc).
How do I make it so that whenever a user go to another page, the URL also includes the search term?
what I mean is really just from 'mysite.com/index?page=2' to 'mysite.com/index?search='looking'&page=2'

in other words, whenever I click on the next page button from simplePaginate, the search term is dismissed, so I can only go to page 2 without the search term right now. I want it so if there's already a GET parameter before, don't discard it, just append, except if the name of the parameter is the same, then overwrite it. Any way I can do this 'the laravel way' ? :D

edit: nevermind. silly me, it was right there on the documentation

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.