Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.1 add Query strings in url

I've declared this route:

Route::get('category/{id}{query}{sortOrder}',['as'=>'sorting','uses'=>'CategoryController@searchByField'])->where(['id'=>'[0-9]+','query'=>'price|recent','sortOrder'=>'asc|desc']);

I want to get this in url: http://category/1?field=recent&order=desc How to achieve this?

like image 516
Arnab Rahman Avatar asked Nov 16 '15 14:11

Arnab Rahman


1 Answers

if you have other parameters in url you can use;

request()->fullUrlWithQuery(["sort"=>"desc"])
like image 196
Oğuz Can Sertel Avatar answered Oct 14 '22 12:10

Oğuz Can Sertel