Skip to content

Commit

Permalink
Support for custom builder classes (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt authored and barryvdh committed Mar 26, 2019
1 parent 2b3c9a2 commit 39c148a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Console/ModelsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
) {
Expand Down

0 comments on commit 39c148a

Please sign in to comment.