How to Get Current Route Name Path in Laravel

Hello devs,

In this Larave route tutorial, I will explain that how to get the current route in Laravel view. So this is Laravel get current route name tutorial and from this example, you will learn Laravel get the current route in blade files. So if you don't know the way of getting the current route in the blade file, then this example is for you.

You know that knowing the current route name in Laravel we can give many conditions. Like we want to create a menu item active system with the current path. That time we can use the current route and make them an active menu in Laravel.

Let's see the example of Laravel 8 get the current route in the blade. Let assume we have a route like that.


use Illuminate\Support\Facades\Route;
use App\Http\Controllers\TestController;

Route::prefix('admin')->group(function () {
    Route::get('/', [TestController::class,'index'])->name('test');


Now see the following code to get the current route name in Laravel blade view:


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

{{ $route }}


Now if you run this code, you will see the below output:




Read also: How to Get Route Prefix in Blade File in Laravel


Hope this Laravel get current route example can help you.


Facebook Github
A web enthusiastic, a self-motivated full-stack software engineer from Dhaka, Bangladesh with experience in developing applications using Laravel , React and Vue js