Name of current Route #192
-
Hello, I am new using this framework, which I want to know how to get the name of the current route? Because if I found an option to return all the routes, but I only want the current one and excuse the inconvenience. |
Beta Was this translation helpful? Give feedback.
Answered by
mychidarko
Apr 22, 2023
Replies: 1 comment 3 replies
-
Hi @henry5059. You can call $route = app()->getRoute(); This will return an array containing the route path and method. You can access the route path using $route = app()->getRoute();
$routePath = $route['path']; |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
mychidarko
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @henry5059. You can call
getRoute
on the Leaf instance to get the current route:This will return an array containing the route path and method. You can access the route path using
['path']