siusiak1000's avatar

More variables GET (paginate and sorting)

Hey! I have a problem remembering GET.

When I have my-domain.pl/shop?page=2 and I click sorting at the price is my-domain.pl/shop?sort=price_desc and I would like moja-domena.pl/shop?page=2&sort=price_desc.

I did a search engine and pagination. When I search for something and then go to the next page, the search engine and pagination pass two variables together (moja-domena.pl/shop?s=a&page=2). I used there in the view {{$ search_results-> appends (['s' => $ query]) -> nextPageUrl ()}} but {{url ('store') -> appends (['s' => $ query ]) }} did not work.

0 likes
1 reply
morteza's avatar

if $search_results is a pagination object you can do this:

{{ $search_results->appends(['sort' => request('sort')])->links() }}

Please or to participate in this conversation.