How to get the view address
questions/ask?title=Laravel%20how%20to%20get%20the%20current%20URL%20without%20a%20domain%20name
Outside the controller
Accessing The Current URLecho url()->current(); // Get the current URL including the query string... echo url()->full();
you can easily get current url in laravel 6, laravel 7, laravel 8 and laravel 9 application. $currentURL = Request::url(); dd($currentURL);
The “path” method is used to retrieve the requested URI. The is method is used to retrieve the requested URI which matches the particular pattern specified in the argument of the method. To get the full URL, we can use the url method.
You can get current URL without a domain name in anywhere by:
request()->path()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With