Posts Learn Components Snippets Categories Tags About
/

Laravel Get URL Path

Learn how to get the current url, previous url and next url in Laravel application

Created on Sep 08, 2021

18 views

Sometimes you might need to get the URL of a current route and below are several ways to get it.

Laravel Get Current URL, Laravel Full URL, Laravel Previous URL


Do note that you can call make use of the "url()" helper from anywhere within the application.
<?php

// Get the current URL without the query string
echo url()->current();

// Get the current URL including the query string
echo url()->full();

// Get the full URL for the previous requess
echo url()->previous();

Snippets by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.

Load comments for Laravel Get URL Path

new

PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your project.

View Components

Other Code Snippets

More