Get Current Url Parameter using Laravel

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.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

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 :


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.

Related FAQ

Here are some more FAQ related to this Article:

  1.   Laravel 5.7 Get Current Page URL path
  2.   laravel get all query string
  3.   Laravel 6 Get All query string parameters
  4.   Send, Get data redirect route with parameters in laravel
  5.   Laravel JSON Encode Decode Handling
  6.   Laravel 6 WhereNotIn Query Example
  7.   PHP Get Query String Parameters using Laravel
  8.   Automatically Refresh/Reload Page using VueJS Example
  9.   PHP jQuery AJAX Live check email Availability
  10.   Angularjs Store in Localstorage - ngStorage

Leave a Reply

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