From 3976a4388dc80272ed7e18b999e64757756116eb Mon Sep 17 00:00:00 2001 From: beamjet Date: Sat, 26 May 2018 04:05:17 +0800 Subject: [PATCH] Remove null relationships in loadMorph before grouped by class name. (#24322) * Remove null attributes/relationships in loadMorph before grouped by class name. * Use filter() without a callback instead. --- src/Illuminate/Database/Eloquent/Collection.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Database/Eloquent/Collection.php b/src/Illuminate/Database/Eloquent/Collection.php index 261902703c5d..4114d8afe3d6 100755 --- a/src/Illuminate/Database/Eloquent/Collection.php +++ b/src/Illuminate/Database/Eloquent/Collection.php @@ -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); })