diff --git a/src/Illuminate/Routing/Route.php b/src/Illuminate/Routing/Route.php index fe88d0d6f2f8..25be726a1ba7 100755 --- a/src/Illuminate/Routing/Route.php +++ b/src/Illuminate/Routing/Route.php @@ -535,17 +535,9 @@ public function signatureParameters($conditions = []) */ public function bindingFieldFor($parameter) { - if (is_int($parameter)) { - $parameters = $this->parameterNames(); + $fields = is_int($parameter) ? array_values($this->bindingFields) : $this->bindingFields; - if (! isset($parameters[$parameter])) { - return null; - } - - $parameter = $parameters[$parameter]; - } - - return $this->bindingFields[$parameter] ?? null; + return $fields[$parameter] ?? null; } /** diff --git a/tests/Routing/RoutingUrlGeneratorTest.php b/tests/Routing/RoutingUrlGeneratorTest.php index 9631519477e4..c981b892ebd2 100755 --- a/tests/Routing/RoutingUrlGeneratorTest.php +++ b/tests/Routing/RoutingUrlGeneratorTest.php @@ -391,8 +391,15 @@ public function testRoutableInterfaceRoutingAsQueryString() $this->assertSame('/foo?foo=routable', $url->route('query-string', ['foo' => $model], false)); } + /** + * @todo Fix bug related to route keys + * + * @link https://github.com/laravel/framework/pull/42425 + */ public function testRoutableInterfaceRoutingWithSeparateBindingFieldOnlyForSecondParameter() { + $this->markTestSkipped('See https://github.com/laravel/framework/pull/43255'); + $url = new UrlGenerator( $routes = new RouteCollection, Request::create('http://www.foo.com/')