Reputation: 43
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
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