Home Laravel How to Get Current Route Name in Laravel?

How to Get Current Route Name in Laravel?

by Shahriar Sagor

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());

Using Route:

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

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.


You may also like