Skip to content
Readerstacks logo Readerstacks
  • Home
  • Softwares
  • Angular
  • Php
  • Laravel
  • Flutter
Readerstacks logo
Readerstacks
How to Get Current Url with Query Params in Laravel

How to Get Current Url with Query Parameters in Laravel ?

Aman Jain, August 27, 2022March 16, 2024

Sometimes in our application we want to Get Current Url with Query Parameters in Laravel. It can be complete url, route name and query params too so that we can fetch the data accordingly and show to user on basis of conditions in our view or controller.

We can easily get current url with query parameters in laravel 5, laravel 6, laravel 7, laravel 8 and laravel 9 application and all example will work in all versions. Majorly we will use url helper and facade function of laravel.

There is multiple ways to find the current url , route name and all information of route with query params in laravel and they are as follow

Get Current URL using url Helper

We will learn to find the query params and current url in this article and also learn to access each of query params by converting them into array so that we can easily parse and use in our view and controller so let’s start the tutorial with methods

Method 1 : Get Current URL using url Helper

To get the url using url helper we need to call as follow

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

//Or FACADE

$currentURL = /URL::current();

Method 2 : Get Current URL With Query Params

In this example we will get all query params as well with help of full method of url helper as follow

$urlWithQuery = url()->full();

//Or FACADE

$currentURL = /URL::full();

Method 3 : Get Current URL With Request Class

In this example we will get all query params as well with help of full method of request class as follow

$urlWithQuery = $request->full();

or we can also get query parameters as follow

request()->get("query_params1");

How to get route name and info in laravel ?

Sometimes we also need to get the route name of current request so we can get as follow

$route = Route::current()->getName();

$name = Route::currentRouteName();

$action = Route::currentRouteAction();

Related

Php Laravel Laravel 9 currentlaravelrequesturl

Post navigation

Previous post
Next post

Related Posts

Laravel insert multiple rows in laravel

How to insert multiple rows in laravel ?

November 12, 2023March 16, 2024

Laravel supports both types of insert statement like single and multiple. In this article we will learn to insert multiple rows in laravel. Laravel, a powerful PHP framework, provides developers with a range of functionalities to streamline database operations. One common task developers often encounter is the need to insert…

Read More
Php make a component in laravel 10

How to create component in Laravel 10 ?

March 23, 2023March 16, 2024

In this tutorial i will show you simple html based component in Laravel 10 using blade. Creating reusable components is a fundamental aspect of modern web development, as it allows developers to simplify code and improve efficiency. Laravel 10, one of the most popular PHP frameworks, comes with a robust…

Read More

Laravel OTP Login and Registration Without Password

September 1, 2022March 16, 2024

Today most of the applications are using laravel otp login and registration without password for ease of login and registration and also provides easy to login without remembering the password each time while login or register. In Laravel there is multiple ways to implement the login and registration like Laravel…

Read More

Aman Jain
Aman Jain

With years of hands-on experience in the realm of web and mobile development, they have honed their skills in various technologies, including Laravel, PHP CodeIgniter, mobile app development, web app development, Flutter, React, JavaScript, Angular, Devops and so much more. Their proficiency extends to building robust REST APIs, AWS Code scaling, and optimization, ensuring that your applications run seamlessly on the cloud.

Categories

  • Angular
  • CSS
  • Dart
  • Devops
  • Flutter
  • HTML
  • Javascript
  • jQuery
  • Laravel
  • Laravel 10
  • Laravel 11
  • Laravel 9
  • Mysql
  • Php
  • Softwares
  • Ubuntu
  • Uncategorized

Archives

  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • October 2024
  • July 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • July 2023
  • March 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Recent Posts

  • Mastering Schedule Management with Laravel Zap
  • The Resilience of Nature: How Forests Recover After Fires
  • Understanding Laravel Cookie Consent for GDPR Compliance
  • Understanding High Vulnerabilities: A Critical Overview of the Week of May 12, 2025
  • Installing a LAMP Stack on Ubuntu: A Comprehensive Guide
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version