Understand Laravel route with optional parameter
问题 I'm trying to create a route with one optional parameter with Laravel 5.4. Route : Route::get('/run/{zone?}/id/{id}', 'RunController@show'); Controller : class RunController extends Controller { public function show() { $route = \Route::current(); $zone = $route->parameter('zone') ?: 'default'; $id = $route->parameter('id'); Run::setZone($zone); $run = Run::findOrFail($id); return view('run.show')->with(['run' => $run]); } } The url run/test/id/42 works like expected. But with run/id/42 I got