How to Get Current Route Name in Laravel?

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Today now in this post i will show you how to get current route name in laravel application. Whenever we need to get the current route name then we can get by using Request or Route facade.Here I will give you two example way one for by using Route facade and another one for by using Request facade.

so we can get the route name both way and how we can see both example.

Using Request:

$routeName = Request::route()->getName());
print($routeName);

Using Route:

$routeName = Route::getCurrentRoute()->getPath();
print($routeName);

Read Also : How to convert Object into Array in PHP?

Thanks for read. I hope it help you. For more you can follow us on facebook.

About code chef

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by code chef →