diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index f4a0bdede..162d2e49b 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -446,7 +446,10 @@ protected function getPropertiesFromMethods($model) } } elseif (in_array($method, ['query', 'newQuery', 'newModelQuery'])) { $reflection = new \ReflectionClass($model); - $this->setMethod($method, '\Illuminate\Database\Eloquent\Builder|\\' . $reflection->getName()); + + $builder = get_class($model->newModelQuery()); + + $this->setMethod($method, "\\{$builder}|\\" . $reflection->getName()); } elseif (!method_exists('Illuminate\Database\Eloquent\Model', $method) && !Str::startsWith($method, 'get') ) {