Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bakerkretzmar committed Apr 22, 2023
1 parent 396516d commit 4d0633d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Ziggy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 4d0633d

Please sign in to comment.