Explorar el Código

Merge pull request #265 from urbsny/patch-5

Support customizing the route key.
Shalvah hace 3 años
padre
commit
6ae5e7ce6e
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      src/Extracting/Strategies/UrlParameters/GetFromLaravelAPI.php

+ 3 - 1
src/Extracting/Strategies/UrlParameters/GetFromLaravelAPI.php

@@ -66,7 +66,9 @@ class GetFromLaravelAPI extends Strategy
                         continue;
                     }
 
-                    $type = $this->normalizeTypeName($argumentInstance->getKeyType());
+                    $typeName = $argumentInstance->getKeyName() === $argumentInstance->getRouteKeyName()
+                        ? $argumentInstance->getKeyType() : 'string';
+                    $type = $this->normalizeTypeName($typeName);
                     $parameters[$paramName]['type'] = $type;
 
                     // If the user explicitly set a `where()` constraint, use that to refine examples