Get Full Current Url In Laravel

[Solved] Get Full Current Url In Laravel | Php - Code Explorer | yomemimo.com
Question : how get url in laravel

Answered by : mohamad-shahkhajeh

// Get the current URL without the query string...
echo url()->current();
// Get the current URL including the query string...
echo url()->full();
// Get the full URL for the previous request...
echo url()->previous();

Source : https://laravel.com/docs/8.x/urls | Last Update : Sat, 29 May 21

Question : Laravel get url

Answered by : irfan-majid

Example 1: current() with Helper
$currentURL = url()->current();
dd($currentURL);
Example 2: full() with Helper(with query string parameters)
$currentURL = url()->full();
dd($currentURL);
Example 3: current() with Facade
$currentURL = URL::current();
dd($currentURL);
Example 4: full() with Facade(with query string parameters)
$currentURL = URL::full();
dd($currentURL);
Example 5: using Request
$currentURL = Request::url();
dd($currentURL);
Get Previous URL in Laravel:
$url = url()->previous();
dd($url);
Get Current Route in Laravel:
$route = Route::current()->getName();
dd($route);

Source : | Last Update : Sat, 11 Jun 22

Question : How to get current url in laravel

Answered by : muhammad-ishaq

//get current url
use Illuminate\Support\Facades\Route;
Route::getFacadeRoot()->current()->uri();
//get current full url
$url = url()->current();

Source : | Last Update : Fri, 13 May 22

Question : laravel current url

Answered by : jareer

use Illuminate\Support\Facades\URL;
echo URL::current();

Source : | Last Update : Thu, 17 Feb 22

Answers related to get full current url in laravel

Code Explorer Popular Question For Php