Regular Expression Constraints
You may constrain the format of your route parameters using the where method on a route instance. The where method accepts the name of the parameter and a regular expression defining how the parameter should be constrained:
Route::get('/user/{name}', function ($name) {
})->where('name', '[A-Za-z]+');
Route::get('/user/{id}', function ($id) {
})->where('id', '[0-9]+');
Route::get('/user/{id}/{name}', function ($id, $name) {
})->where(['id' => '[0-9]+', 'name' => '[a-z]+']);