使用Laravel路线中的参数

I am using the resourceful routing for a laravel 4 application. Here is my code on the routes.php file

Route::resource('/users', 'UserController');

When i navigate to public/users/1 it works as expected, it shows the record with id = 1. Now what i noticed is when i navigate to public/users/1-xxxxxxx or any text after the id, it shows the record with id=1. My first question is, is this supposed to happen?

2nd question is, how would i create a url just like stackoverflow, where for example the username is included on the url after the id where the separator between them is a slash.

something like public/users/1/john.

To answer the question on how to do this kind of URL like

public/users/1/john.

You could setup your route like:

routes.php

Route::get('users/{id}/{username}', 'UserController@showUser');

UserController

public function showUser($id, $username)
{
    //do stuff here
}