Fix return value of scopes from parent class (#1366)

This commit is contained in:
sforward
2024-04-01 08:43:59 +02:00
committed by GitHub
parent ac7e186270
commit 6338abb2d7
6 changed files with 245 additions and 3 deletions
+3 -3
View File
@@ -616,7 +616,7 @@ class ModelsCommand extends Command
$this->setProperty($name, null, null, true, $comment);
}
} elseif (Str::startsWith($method, 'scope') && $method !== 'scopeQuery' && $method !== 'scope' && $method !== 'scopes') {
//Magic set<name>Attribute
//Magic scope<name>Attribute
$name = Str::camel(substr($method, 5));
if (!empty($name)) {
$comment = $this->getCommentFromDocBlock($reflection);
@@ -628,8 +628,8 @@ class ModelsCommand extends Command
get_class($model->newModelQuery())
);
$modelName = $this->getClassNameInDestinationFile(
$reflection->getDeclaringClass(),
$reflection->getDeclaringClass()->getName()
new \ReflectionClass($model),
get_class($model)
);
$this->setMethod($name, $builder . '|' . $modelName, $args, $comment);
}