How to get current URL in Laravel 6/7 ?

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 facilely.

Laravel provide URL facade that way we can get current URL anywhere, as bellow you can optically discern 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:

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

About OakML

Hi we are enthusiastic developers team, we try to serve some good idea to open source community

Leave a Reply

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

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!