April 10, 2016
Category : Laravel
How to Get Current Route Name in Laravel?
Whenever you need to get current route name then you can get using Request or Route facade. I give you two example one for using Route facade and another for Request facade. so you can get route name both way and how you can see both example.
Using Request:
$routeName = Request::route()->getName());
print($routeName);
Using Route:
$routeName = Route::getCurrentRoute()->getPath();
print($routeName);

Hardik Savani
I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.