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

freel's avatar
Level 8

Search filter

Hello,

I am doing search filter. I have question regarding routing Let's say we have url:

http://project35.dev/cars/10/grid/name/bmw/320/black

I want to do filter and change only 1 value in url. Let's say we have html:

     <button type="button" class="btn btn-default listing-sort-btn">Sort by</button>
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                        <span class="caret"></span>
                        <span class="sr-only">Toggle Dropdown</span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="#">Price (High to Low)</a></li>
                        <li><a href="#">Price (Low to High)</a></li>
                        <li><a href="#">Mileage (Low to High)</a></li>
                        <li><a href="#">Mileage (High to Low)</a></li>
                    </ul>
                </div>

                <div class="toggle-view view-count-choice pull-right">
                    <label>Show</label>
                    <div class="btn-group">
                        <a href="#" class="btn btn-default">10</a>
                        <a href="#" class="btn btn-default active">20</a>
                        <a href="#" class="btn btn-default">50</a>
                    </div>
                </div>

is any function somehing like:

route::current([pagginate => 50])

lets say here 50 I want update only 1 parrameter 10 to 50

How you do it?

I hope you understand what I want to achieve.

0 likes
5 replies
freel's avatar
Level 8

Before i had http://project35.dev/cars/?perpage=20

and I was using this:

<a href="{{Request::fullUrlWithQuery(array('perpage' => 10))}}" class="btn btn-default {{ Request::input('perpage') == 10 ? 'active' : '' }}">10</a>
topvillas's avatar

I'd say yes.

I wouldn't include things in the URL that are search parameters, unless the search is very specific and you're using route model binding (you might want to consider that).

It will tie you down to a very specific pattern and make the search a lot less flexible.

freel's avatar
Level 8

Well, I was planning to use it, but can skip this.

Thank you for advice.

Please or to participate in this conversation.