Skip to content

Instantly share code, notes, and snippets.

@Tynael
Created January 18, 2023 16:06
Show Gist options
  • Save Tynael/6164f9bc474c95049df47bb6f0b383ef to your computer and use it in GitHub Desktop.
Save Tynael/6164f9bc474c95049df47bb6f0b383ef to your computer and use it in GitHub Desktop.
How to Get Current URL Inside Blade Templates
<!DOCTYPE html>
<head></head>
<body>
<p>
<!-- Our URL: http://localvaren.com/home?param=neutrondev -->
<!--
Get the current URL
Output: http://localvaren.com/home
-->
{{ request()->url() }}
{{ Request::url() }}
<!--
Get the full URL
Output: http://localvaren.com/home?param=neutrondev
-->
{{ request()->fullUrl() }}
{{ Request::fullUrl() }}
<!--
Get only the path
Output: home
-->
{{ request()->path() }}
{{ Request::path() }}
</p>
</body>
</html>
@Tynael
Copy link
Author

Tynael commented Jan 18, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment