Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel how to get the current URL without a domain name?

Tags:

laravel

How to get the view address

questions/ask?title=Laravel%20how%20to%20get%20the%20current%20URL%20without%20a%20domain%20name

Outside the controller

like image 993
symfony_fan Avatar asked Oct 01 '18 11:10

symfony_fan


People also ask

How can I get current URL in laravel?

Accessing The Current URLecho url()->current(); // Get the current URL including the query string... echo url()->full();

How do I find URL in laravel 8?

you can easily get current url in laravel 6, laravel 7, laravel 8 and laravel 9 application. $currentURL = Request::url(); dd($currentURL);

How can you retrieve the full URL for the incoming request in laravel?

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.


1 Answers

You can get current URL without a domain name in anywhere by:

request()->path()
like image 140
Sand Of Vega Avatar answered Sep 17 '22 13:09

Sand Of Vega