Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 29, 2020
1 parent 96d9ac5 commit 15586fa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Illuminate/Database/Eloquent/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,15 @@ public function toQuery()
$model = $this->first();

if (! $model) {
throw new LogicException('can not get Eloquent QueryBuilder from an empty Collection.');
throw new LogicException('Unable to create query for empty collection.');
}

$class = get_class($model);

if ($this->filter(function ($model) use ($class) {
return ! $model instanceof $class;
})->isNotEmpty()) {
throw new LogicException('Unable to create query for collection with mixed types.');
}

return $model->newModelQuery()->whereKey($this->modelKeys());
Expand Down

0 comments on commit 15586fa

Please sign in to comment.