diff --git a/src/Ziggy.php b/src/Ziggy.php index bc7731f3..2fd72ddc 100644 --- a/src/Ziggy.php +++ b/src/Ziggy.php @@ -199,12 +199,11 @@ private function resolveBindings(array $routes): array $model = class_exists(Reflector::class) ? Reflector::getParameterClassName($parameter) : $parameter->getType()->getName(); - $override = (new ReflectionClass($model))->isInstantiable() - && ( - (new ReflectionMethod($model, 'getRouteKeyName'))->class !== Model::class - || (new ReflectionMethod($model, 'getKeyName'))->class !== Model::class - || (new ReflectionProperty($model, 'primaryKey'))->class !== Model::class - ); + $override = (new ReflectionClass($model))->isInstantiable() && ( + (new ReflectionMethod($model, 'getRouteKeyName'))->class !== Model::class + || (new ReflectionMethod($model, 'getKeyName'))->class !== Model::class + || (new ReflectionProperty($model, 'primaryKey'))->class !== Model::class + ); // Avoid booting this model if it doesn't override the default route key name $bindings[$parameter->getName()] = $override ? app($model)->getRouteKeyName() : 'id';