DEV Community

Tutsmake
Tutsmake

Posted on

Laravel 10 Get Current Route Name in Blade & Controller

You can get the current route name in Laravel using the route() function. You can pass the route name as an argument to the function, and it will return the route using that name.

Laravel 10 Get Current Route Name in Blade & Controller

Here are some examples of getting the current route name in Laravel:

  • $routeName = Route::getCurrentRoute()->getPath(); print($routeName)
  • $name = $route->getName(); dd($name)
  • $name = Route::currentRouteName(); dd($name)

Read More Laravel 10 Get Current Route Name in Blade & Controller

Top comments (0)