In this example, I will show you how to get laravel 9 get current route name in the blade file. You know that we need the current route name when we need to show a specific link active in Laravel.

We can get the current route name in the blade file using Route::current() method in Laravel. See the example code:

resources/views/welcome.blade.php

@php
    $route = Route::current()->getName();
    // $route is your current route
@endphp

 

Read also: How To Check Requested Route In Laravel

 

Hope it can help you.

Category : #laravel

Tags : #laravel , #laravel routing