Get current route name in laravel 5


Get current route name in laravel 5 : You can get the current route name in laravel 5 simply using the Route::getCurrentRoute()->getPath();. Here in this tutorial we are going to explain the methods to get the current route.


Get current route name in laravel 5

You can use the below method to get the current route in the laravel5 –

Get current route name in laravel 5:

Route::getCurrentRoute()->getPath();
or 
\Request::route()->getName();

The above example will give you the current route in laravel 5.1

Get Route Action Name

You can use the below syntax to get the current route name –

How to get current route name in laravel 5:

Route::getCurrentRoute()->getActionName();

The above example will give you the current route action name in laravel 5.1


Advertisements

Add Comment

📖 Read More