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 10 – Error During installation laravel/framework[v10.0.0] require composer-runtime-api ^2.2 – Solved

March 8, 2023March 16, 2024

Today i was installing laravel 10 with php version 8.2 and i encountered an issue laravel/framework[v10.0.0, …, v10.3.2] require composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint. This issue occurred due to old composer. So we can quickly fix this by running below command May be…

Read More
Php How to rename column in laravel migration

How to rename column name in laravel 8 / 9 migration ?

February 20, 2022August 17, 2022

Laravel covers most of the migration features like add, delete, indexing etc. but to modify the table like renaming column, change data type column to existing table laravel uses a separate package doctrine/dbal. In laravel migration we can rename colum to existing table using the method renameColumn(). We can install…

Read More
Javascript Laravel Customized Autocomplete JQuery UI

Laravel Customized Autocomplete JQuery UI

July 12, 2022July 12, 2022

Laravel Customized Autocomplete JQuery UI is useful when we want live search of bulk data. Autocomplete search is mostly work of javascript and when we want to fetch live data from database then we require the intervention of laravel to provide the data in json response. In this tutorial we…

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

  • 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

  • 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
  • Understanding High Vulnerabilities: A Deep Dive into Recent Security Concerns
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version