I try to display the current route name in a view and was using something along the lines {{ Route::getCurrentRoute()->getActionName() }} and in my routes.php:
use Illuminate\Support\Facades\Route;
However, this throws the following error:
Fatal error: Call to undefined function getCurrentRoute()
@bestmomo Thank you, but $app->getRoutes() is empty for me. I tried adding the code in the routes.php since I don't really use the Controller at all the moment.
@bashy I actually just want to add the subtitle in the <title> in my blade view based on the current route name. Not sure but perhaps there's a better approach to do so?
I know it's too old but, if somebody else is looking for the same thing, they can acchieve it as shown below
//Lumen 5.8 (I am inside a middleware, that's way I have "$request" as a variable)
app()->router->getRoutes()[$request->method() . $request->getPathInfo()]