Laravel资源路由中的多个通配符

I declared resource route like below

Route::resource('{slug}/user','ManageUsersController');

This gives me a route

{slug}/user/{id}

where slug is the slug of a company name and id is the specific id of user.

In view, I declared anchor tag : <a href=user/{!! $user->id!!}>User</a> This directs me to the function show in ManageUserController

 public function show($id)
    {
        return $id;
    }

But the return result is the slug, not the the id of the user. My URL is project/company-name/user/5

Where did i go wrong ? how can i get the user ID in return rather than the slug ?

-thanx

you have to catch both slug and id in your method,so your method will like

public function show($slug, $id)
{
    //for slug
    return $slug;
    //for id
    return $id;
}

Pass both parameters to your controller method, because Laravel will consider the first parameter to be the first parameter in the route (which would be your slug).