Get Current Route Name using Laravel Example – Laravel

Get Current Route Name using Laravel Example – Laravel

In this post we will give you information about Get Current Route Name using Laravel Example – Laravel. Hear we will give you detail about Get Current Route Name using Laravel Example – LaravelAnd how to use it also give you demo for it if it is necessary.

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.

Example 1: Get current route name in Blade Files

Accessing The Current Route using Laravel

$route = Route::current();
dd($route);

$name = $route->getName();
dd($name);

$actionName = $route->getActionName();
dd($actionName);

$name = Route::currentRouteName();
dd($name);

$action = Route::currentRouteAction();
dd($action);

Using Request:

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

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

Using Route:

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

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 AppHttpControllers[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 – onlinecode

Another must read:  How to Get Laravel last inserted ID from database
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

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 onlinecode 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.

Hope this code and post will helped you for implement Get Current Route Name using Laravel Example – Laravel. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  5  =  8

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US