Home >Backend Development >PHP Tutorial >How to Get the Current Route Name in Laravel (v5 - v7)?
Get Current Route Name in Laravel (v5 - v7)
In earlier versions of Laravel (v4), the Route::currentRouteName() method could be used to retrieve the current route name. However, from Laravel v5 onwards, this method is no longer available.
Laravel v5
In Laravel v5, you can get the current route name using the following methods:
Laravel v5.2
From Laravel v5.2 onwards, the Route::currentRouteName() method is reintroduced:
Laravel v5.3 - v5.8
In Laravel v5.3 and later:
Laravel v6.x - v7.x
This method remains the same in Laravel v6.x and v7.x:
Using Request
In all versions of Laravel, you can also use the Request object to get the current route name:
Additional Information
The above is the detailed content of How to Get the Current Route Name in Laravel (v5 - v7)?. For more information, please follow other related articles on the PHP Chinese website!