From 5318f485e23983c69a7ae3fa39e2d078bcdee4b1 Mon Sep 17 00:00:00 2001 From: Brent Roose Date: Fri, 7 Sep 2018 10:27:20 +0200 Subject: [PATCH] Add ::query support --- src/Console/ModelsCommand.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index d3fdfd8..3e15915 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -409,6 +409,7 @@ class ModelsCommand extends Command protected function getPropertiesFromMethods($model) { $methods = get_class_methods($model); + if ($methods) { sort($methods); foreach ($methods as $method) { @@ -444,6 +445,9 @@ class ModelsCommand extends Command array_shift($args); $this->setMethod($name, '\Illuminate\Database\Eloquent\Builder|\\' . $reflection->class, $args); } + } elseif (in_array($method, ['query', 'newQuery', 'newModelQuery'])) { + $reflection = new \ReflectionClass($model); + $this->setMethod($method, '\Illuminate\Database\Eloquent\Builder|\\' . $reflection->getName()); } elseif (!method_exists('Illuminate\Database\Eloquent\Model', $method) && !Str::startsWith($method, 'get') ) {