Posted inLaravel / php

get current url laravel – How to get current URL in controller or view?

get current url laravel using url()->current(), url()->full(), URL::current(), URL::full(), Request::url() and url()->previous() Best Examples.

get current url laravel

You can get current url in laravel using following methods.

Get Current URL in Laravel:

Example 1: current() with Helper

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

Example 2: full() with Helper(with query string parameters)

$exampleTestURI = url()->full();
    
dd($exampleTestURI);

Example 3: current() with Facade

$exampleTestURI = URL::current();
    
dd($exampleTestURI);

Example 4: full() with Facade(with query string parameters)

$exampleTestURI = URL::full();
    
dd($exampleTestURI);

Example 5: using Request

$exampleTestURI = Request::url();
  
dd($exampleTestURI);

Don’t Miss : laravel get current url

Get Previous URL in Laravel:

$results = url()->previous();
  
dd($results);

Get Current Route in Laravel:

$results = Route::current()->getName();
  
dd($results);

I hope you get an idea about get current url laravel.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype