Skip to main content

Get Current Route Name using Laravel Example

Today, We want to share with you Get Current Route Name using Laravel Example.In this post we will show you How to check current URL or Route, hear for Route::currentRouteName() returns the route name we will give you demo and example for implement.In this post, we will learn about How to get current route name path and action in laravel 5 with an example.

Get Current Route Name using Laravel Example

There are the Following The simple About Get Current Route Name using Laravel Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel 5.5 Get Route Name in Controller, View and Middleware, so the php – How to get current route name in laravel 5? for this example is following below.

Also Read :  Installing laravel on windows wamp xampp

Example 1: Get current route name in Blade Files

Accessing The Current Route using Laravel

$route = Route::current();

$name = $route->getName();

$actionName = $route->getActionName();

$name = Route::currentRouteName();

$action = Route::currentRouteAction();

Using Request:

$route_liveName = Request::route()->getName());

Using Route:

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

Example 2: get current route name using Laravel

return \Request::route()->getName(); 
// response membersDATA.index

return \Route::currentRouteName(); 
// response membersDATA.index

Example 3: get current route path using Laravel

 return \Route::getCurrentRoute()->getPath(); 
 // response membersDATA

Example 4: get current route action using Laravel

 return \Route::getCurrentRoute()->getActionName(); 
 //response App\Http\Controllers\[email protected]

Example 5: get a list of all routes using Laravel?

 $all_routes = \Route::getRoutes();
 foreach ($all_routes as $route) {
    echo $route->getPath().'<hr/>';

Free Download Example –

Angular 6 CRUD Operations Application Tutorials

Read :

Also Read :  Simple Laravel Dynamic Select Boxes Example


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Get Current Route Name using Laravel Example.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Web Developer

Hi, I’m Web developer, PHP is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development.Any visitors of this site are free to browse our tutorials, live demos, Examples and download scripts.If you have a project that you want to get started, launch quickly, contact me. Email : [email protected]