laravel get current url – How to Get Current URL and Site URL in Laravel?

laravel get current url using URL::current(), URL::to(“/”), url(‘/’), Route::current()->getName() and Request::route()->getPrefix() Examples

laravel get current url

Accessing The Current URL You can use: Request::url() to obtain the current URL. Client side You can use url() helper in laravel blade url()->current().

Free Live Chat for Any Issue

Current URL in Laravel


$exampleTestURI = URL::current();

SIte URL in Laravel

$exampleTestURI = URL::to("/");

or use

$exampleTestURI = url('/');

Get current route name in laravel

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

Don’t Miss : Laravel 5.7 Get Current Page URL Path

Also Read This πŸ‘‰   How to set limit and offset in Laravel Eloquent?

Get current route prefix name in laravel

$prefix = Request::route()->getPrefix() Examples;

I hope you get an idea about laravel get current url.
I would like to have feedback on my infinityknow.com 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.