Support for custom builder classes (#782)

This commit is contained in:
Brent Roose
2019-03-26 11:38:22 +01:00
committed by Barry vd. Heuvel
parent 2b3c9a2449
commit 39c148ad42
+4 -1
View File
@@ -446,7 +446,10 @@ class ModelsCommand extends Command
} }
} elseif (in_array($method, ['query', 'newQuery', 'newModelQuery'])) { } elseif (in_array($method, ['query', 'newQuery', 'newModelQuery'])) {
$reflection = new \ReflectionClass($model); $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) } elseif (!method_exists('Illuminate\Database\Eloquent\Model', $method)
&& !Str::startsWith($method, 'get') && !Str::startsWith($method, 'get')
) { ) {