Laravel 6 In Get Current URL with Parameters – onlinecode

Laravel 6 In Get Current URL with Parameters – onlinecode

In this post we will give you information about Laravel 6 In Get Current URL with Parameters – onlinecode. Hear we will give you detail about Laravel 6 In Get Current URL with Parameters – onlinecodeAnd how to use it also give you demo for it if it is necessary.

In this tutorial, today we discuss about how to get current URL with parameters in laravel 6. we can get by using the URL helper class and also use the facade class and request an object for laravel get URL. so we gave following below various types for how to get the current URL(laravel get URL).

Get the current URL without the query string

PHP
$currentURL = url()->current();
dd($currentURL);

Get the current URL including the query string

PHP
$currentURL = url()->full();
dd($currentURL);

Get the full URL for the previous request

PHP
$preURL = url()->previous();
dd($preURL);

Get the current URL Without Query String

PHP
$currentURL = $request->url();
dd($currentURL);

Get the current URL With Query String

PHP
$currentURL = $request->fullUrl();
dd($currentURL);

Get Only Parameters Using segment

PHP
//http://www.example.com/one/two?key=value
$currentURL = $request->segment(3);
dd($currentURL);

Please follow and like us:

Hope this code and post will helped you for implement Laravel 6 In Get Current URL with Parameters – onlinecode. 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 *

  +  70  =  73

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