Sometimes we need to check the current URL of requests in our application. Either we need to check the complete path or a specific string of current URL. It can be done easily using following methods provided with Laravel request object: Inspecting The Request Path / Route

The url method will return the URL without the query string, while the fullUrl method includes the query string: $url = $request->url(); $urlWithQueryString = $request->fullUrl(); If you would like to append query string data to the current URL, you may call the fullUrlWithQuery method. This method merges the given array of query string variables with the current query string: $request->fullUrlWithQuery(['type' => 'address']); so these are the ways to check and work on current URL in Laravel.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners