Skip to content

Commit 2579f6f

Browse files
Merge branch 'master' of github.com:belcheck-pty-ltd/laravel-openapi
2 parents 1fc9082 + 20e7f65 commit 2579f6f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Console/SchemaFactoryMakeCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ protected function buildClass($name)
3535

3636
protected function buildModel($output, $model)
3737
{
38-
$model = Str::start($model, $this->laravel->getNamespace());
38+
$namespace = app()::VERSION[0] >= 8 ? $this->laravel->getNamespace().'Models\\' : $this->laravel->getNamespace();
39+
$model = Str::start($model, $namespace);
3940

4041
if (! is_a($model, Model::class, true)) {
4142
throw new InvalidArgumentException('Invalid model');

src/RouteInformation.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,14 @@ public static function createFromRoute(Route $route): RouteInformation
8383
$actionAttributes = collect($reflectionMethod->getAttributes())
8484
->map(fn (ReflectionAttribute $attribute) => $attribute->newInstance());
8585

86+
$containsControllerLevelParamter = $actionAttributes->contains(fn ($value) => $value instanceof \Vyuldashev\LaravelOpenApi\Attributes\Parameters);
87+
8688
$instance->domain = $route->domain();
8789
$instance->method = $method;
8890
$instance->uri = Str::start(preg_replace('/{(.*?)}/', '{${1}:id}', $route->uri), '/');
8991
$instance->name = $route->getName();
9092
$instance->controller = $controller;
91-
$instance->parameters = $parameters;
93+
$instance->parameters = $containsControllerLevelParamter ? collect([]) : $parameters;
9294
$instance->controllerAttributes = $controllerAttributes;
9395
$instance->action = $action;
9496
$instance->actionParameters = $reflectionMethod->getParameters();

0 commit comments

Comments
 (0)