diff --git a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php b/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php index 4fbc2f90ebd1..7456fc6e4a6f 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php +++ b/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php @@ -223,7 +223,7 @@ public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boole }; } - $query->where($this->query->from.'.'.$relation->getMorphType(), '=', (new $type)->getMorphClass()) + $query->where($this->qualifyColumn($relation->getMorphType()), '=', (new $type)->getMorphClass()) ->whereHas($belongsTo, $callback, $operator, $count); }); }