diff --git a/src/Illuminate/Routing/Route.php b/src/Illuminate/Routing/Route.php index f09d7fafaebd..f23d75d7a5d2 100755 --- a/src/Illuminate/Routing/Route.php +++ b/src/Illuminate/Routing/Route.php @@ -551,7 +551,7 @@ public function bindParameters(Request $request) ); } - return $this->parameters = $this->replaceDefaults($params); + return $this->parameters = $this->fillDefaults($this->replaceDefaults($params)); } /** @@ -615,6 +615,23 @@ protected function replaceDefaults(array $parameters) return $parameters; } + /** + * Fill missing parameters with their defaults. + * + * @param array $parameters + * @return array + */ + protected function fillDefaults(array $parameters) + { + foreach ($this->defaults as $key => $value) { + if (! isset($parameters[$key])) { + $parameters[$key] = $value; + } + } + + return $parameters; + } + /** * Parse the route action into a standard array. *