Laravel – How to get current URL in controller or view?

Laravel – How to get current URL in controller or view?

In this post we will give you information about Laravel – How to get current URL in controller or view?. Hear we will give you detail about Laravel – How to get current URL in controller or view?And how to use it also give you demo for it if it is necessary.

We always require to get current URL path when work on ajax pagination or something, at that we require to get current page URL on Controller or blade file. So, you can get current url easily.

Laravel provide URL facade that way we can get current URL anywhere, as bellow you can see i use current() of URL facade. URL facade through you can get your current page url from every where. So you can check your current url this way:

Example:

Also see:How to Get Current Controller Name in View Laravel?

$currentURL = URL::current();

dd($currentURL);

Hope this code and post will helped you for implement Laravel – How to get current URL in controller or view?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

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

2  +  2  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US