-1

How do I get the route a user is currently at? I need that to hide a navbar link if a user is currently at the route that link leads to.

Dan
  • 5,140
  • 2
  • 15
  • 30
  • 1
    Does this answer your question? [Laravel: How to Get Current Route Name? (v5 & v6)](https://stackoverflow.com/questions/30046691/laravel-how-to-get-current-route-name-v5-v6) – Don't Panic Apr 22 '20 at 01:25
  • Welcome to Stackoverflow. Please try searching before posting a new question, there are many duplicates of this here already. – Don't Panic Apr 22 '20 at 01:25

1 Answers1

2

You may use the current, currentRouteName, and currentRouteAction methods to access information about the route handling the incoming request:

$route = Route::current();
$name = Route::currentRouteName();
$action = Route::currentRouteAction();

You can check this Link too

Hope it helps...

Nazem Mahmud Piash
  • 1,053
  • 1
  • 13
  • 34