Mihai Stana

How to Get Current URL in Laravel

0 min read ยท 5 July, 2024

full() with Helper and Query string parameters

<?php
$currenturl = url()->full();
dd($currenturl);

current() with Helper

$currenturl = url()->current();
dd($currenturl);

using Request

$currenturl = Request::url();

dd($currenturl);

current() with Facade

$currenturl = URL::current();

dd($currenturl);

full() with Facade and Query string parameters

$currenturl = URL::full();

dd($currenturl);

Get Previous URL in Laravel

$pre_url= url()->previous();

dd($pre_url);

Get Current Route in Laravel

$cur_route = Route::current()->getName();

dd($cur_route);