In this post, I will tell you how can you get base url, current url with query string and url segment in Laravel.
While working with Laravel, i need many times to get current url and its segment, you can get current url by using helper function
- return \URL::current();
- return \Request::url();
- return \Request::fullUrl();
You can easily get your url segment in Laravel by using
segment method. Let's assume i have a url with some query string.
- $url_segment = \Request::segment(3);