Skip to content

Commit

Permalink
Remove null relationships in loadMorph before grouped by class name. (#…
Browse files Browse the repository at this point in the history
…24322)

* Remove null attributes/relationships in loadMorph before grouped by class name.

* Use filter() without a callback instead.
  • Loading branch information
beamjet authored and taylorotwell committed May 25, 2018
1 parent bed21a5 commit 3976a43
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Illuminate/Database/Eloquent/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ protected function loadMissingRelation(Collection $models, array $path)
public function loadMorph($relation, $relations)
{
$this->pluck($relation)
->filter()
->groupBy(function ($model) {
return get_class($model);
})
Expand Down

0 comments on commit 3976a43

Please sign in to comment.