Blind Fish
Blind Fish

Reputation: 998

Route Error in Laravel 5.2

I am setting up my own admin for a Laravel project and everything is going along fine until I hit what seems to be a routing issue. Here's my situation so far.

Within my views folder I have a folder named panel which holds all of my views for the admin panel. This is working perfectly. I have full access to the panel without a problem. Within the panel directory I have a folder named users which holds my views for the UsersControllers. This is where I'm struggling. My route for those views is as follows:

Route::resource('users', 'UsersController');

Route:list shows those routes as users.index, users.store etc.

In the top nav bar of the panel I have a link to the users index as

<li><a href="{{ url('/users.index') }}">Users</a></li>

I've also tried using

<li><a href="{{ url('users.index') }}">Users</a></li>

Either way, this should be calling the index() method of the UsersController. That method looks like this

public function index()
{
    return view('panel.users.index');
}

I've also tried just

public function index()
{
    return view('users.index');
}

No matter what I try I get

NotFoundHttpException in RouteCollection.php line 161:

I would really appreciate a bit of wisdom on how to resolve this one.

Upvotes: 0

Views: 174

Answers (1)

Md Rashedul Hoque Bhuiyan
Md Rashedul Hoque Bhuiyan

Reputation: 10641

you can use this for index

<li><a href="{{ url('users') }}">Users</a></li>

or you can use action

<li><a href="{{ action('UsersController@index') }}">Users</a></li>

Upvotes: 2

Related Questions