URL::to and url() question regarding the query string #45413
-
Hi, Laravel v9.45.1:- I am not sure if I am confused or this is a bug. Now when I add my query string the generated url just ignores them all... If I use a relative path, the parameters are added as an additional path rather than query string. Attached some photos from the tinker. Is there a way to do this for absolute URLs? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The $url = 'https://www.google.com?'.http_build_query(['bar' => 'baz']); // https://www.google.com?bar=baz additionally, if you want to redirect to an external domain you may use: return redirect()->away('https://www.google.com?'.http_build_query(['bar' => 'baz'])); |
Beta Was this translation helpful? Give feedback.
The
url
helper function andURL
facade are for generating URLs within your application (internal) you may use PHPhttp_build_query
function instead:additionally, if you want to redirect to an external domain you may use: