Ande Caleb
Ande Caleb

Reputation: 1204

Getting route name in laravel 4.2 in all views

i have this route defined in my routes file ::

Route::get('user/dashboard', ['as'=>'dashboard', 'uses'=>'AdminController@index']);

and i am trying to read the name of the route, in this case 'dashboard', in all my views, already i know how to pass that using the view::share() method. I have checked everywhere online, and looking through the laravel API, i have seen several methods two of which are,

//1. Route::currentRouteName();
//2. Route::getName(); 

but none of them seems to be working, please what am i doing wrong and what is the best way to get the name string...

regards.

Upvotes: 0

Views: 844

Answers (1)

Ravi Hirani
Ravi Hirani

Reputation: 6539

The Request class provides many methods for examining the HTTP request for your application and extends the Symfony\Component\HttpFoundation\Request class

Write Request::path() to get current URI.

Check this Documentation

Upvotes: 1

Related Questions