Skip to content

Commit

Permalink
Merge pull request #32614 from ddzobov/hasMorph-filter-null
Browse files Browse the repository at this point in the history
[7.x] Filtering null's in hasMorph()
  • Loading branch information
taylorotwell authored Apr 30, 2020
2 parents dcaf8a8 + 117fdca commit 4cc82f3
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boole
$types = (array) $types;

if ($types === ['*']) {
$types = $this->model->newModelQuery()->distinct()->pluck($relation->getMorphType())->all();
$types = $this->model->newModelQuery()->distinct()->pluck($relation->getMorphType())->filter()->all();

foreach ($types as &$type) {
$type = Relation::getMorphedModel($type) ?? $type;
Expand Down

0 comments on commit 4cc82f3

Please sign in to comment.