From 9fa5ac4d4d0538807ff2b23f8c9825362748b8e8 Mon Sep 17 00:00:00 2001 From: Loris Leiva Date: Thu, 21 May 2020 17:17:41 +0100 Subject: [PATCH] Method bindingFieldFor did not exist before L7 See #42 --- src/Concerns/ResolvesMethodDependencies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Concerns/ResolvesMethodDependencies.php b/src/Concerns/ResolvesMethodDependencies.php index 900189c..40c80bb 100644 --- a/src/Concerns/ResolvesMethodDependencies.php +++ b/src/Concerns/ResolvesMethodDependencies.php @@ -68,7 +68,7 @@ protected function resolveContainerDependency($class, $key, $value) protected function resolveRouteBinding($instance, $key, $value) { $route = $this->runningAs('controller') ? $this->request->route() : null; - $field = optional($route)->bindingFieldFor($key); + $field = $route && method_exists($route, 'bindingFieldFor') ? $route->bindingFieldFor($key) : null; $parent = $route && method_exists($route, 'parentOfParameter') ? $route->parentOfParameter($key) : null; if ($parent && $field && $parent instanceof UrlRoutable) {