Adam Craft
Adam Craft

Reputation: 43

Get the name of the current route in Laravel 5.5

I know that in previous versions of Laravel you could fetch the name by calling the getCurrentRoute in the route class, but since 5.5 was released it still remains a mystery on how I can do this?

In previous versions, this is how I did it.

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

Upvotes: 4

Views: 1930

Answers (1)

Ottawa
Ottawa

Reputation: 124

You can call the currentRouteName on the route class.

Route::currentRouteName();

Don't forget to use the class.

use Illuminate\Support\Facades\Route;

Upvotes: 5

Related Questions