Skip to content

Commit

Permalink
Simplify loadMorph()
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Jan 6, 2019
1 parent 8d105f0 commit 8790908
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/Illuminate/Database/Eloquent/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,8 @@ public function loadMorph($relation, $relations)
->groupBy(function ($model) {
return get_class($model);
})
->filter(function ($models, $className) use ($relations) {
return Arr::has($relations, $className);
})
->each(function ($models, $className) use ($relations) {
static::make($models)->load($relations[$className]);
static::make($models)->load($relations[$className] ?? []);
});

return $this;
Expand Down

0 comments on commit 8790908

Please sign in to comment.