Retrieve request URL without specific query parameters in Laravel

1 · Amit Merchant · Sept. 24, 2021, 6:21 p.m.
When you have a request in hand and if the URL is having a query string with different parameters, the easiest way to get the entire URL with the query string is using the fullUrl() method like so. $urlWithQueryString = $request->fullUrl(); // https://www.amitmerchant.com?search=Laravel&sort=asc Now, if you want to append additional parameters in the existing URL query string, you can use the fullUrlWithQuery() like so. $urlWithQueryString = $request->fullUrlWithQuery(['lang' => 'en']); // ht...