Get Current Url Parameter using Laravel

Laravel Redirect To Another URL / Web Page - HTTP Laravel Redirects

Today, We want to share with you Get Current Url Parameter using Laravel.In this post we will show you laravel get url parameters in middleware, hear for get value of URL parameters into Controller (Laravel) we will give you demo and example for implement.In this post, we will learn about Laravel Request getting current path with query string with an example.

Get Current Url Parameter using Laravel

There are the Following The simple About Get Current Url Parameter using Laravel Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel 5.7 get current url with parameters, so the laravel get url parameters in view for this example is following below.

Get Current URL with Parameters:

using Request Facade

$GetcurrentURL = \Request::fullUrl();


Get Current URL without Parameters:

using URL Facade

$GetcurrentURL = \URL::current();


//OR Second Way

$GetcurrentURL = \Request::url();


Get Only Parameters:

using $request Object


$parameters = \Request::segment(3);


Laravel – get current URL in controller or view?

$GetcurrentURL = URL::current();

Laravel Get Current URL in a Blade View

Get the current path

@if (Request::path() == '/product-title')
    // your condition Source Code

Compare the current URL to a pattern

@if (Request::is('product/*'))
    // your condition Source Code

Get only a segment of the current URL

// Returns true for and false for
@if (Request::segment(2) == 'post')
    // your condition Source Code

Get the URL without query string

@if (Request::url() == 'some string')
    // your condition Source Code

Get the full URL, including query string

@if (str_contains(Request::fullUrl(), 'product-list'))
    // your condition Source Code

Angular 6 CRUD Operations Application Tutorials

Read :

Read Also:  Laravel 6 Get All query string parameters


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Get Current Url Parameter using Laravel.
I would like to have feedback on my 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.

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of 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.

View all posts by Pakainfo →

Leave a Reply

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