Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Prevent ambiguous column with table name prefix #31174

Merged
merged 1 commit into from
Jan 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boole
};
}

$query->where($relation->getMorphType(), '=', (new $type)->getMorphClass())
$query->where($this->query->from.'.'.$relation->getMorphType(), '=', (new $type)->getMorphClass())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this needs to be $this->wrapTable($this->query->from), there are other such examples if you search for ->wrapTable()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the same syntax used in QueriesRelationships@withCount method row 363. Do you suggest to update also that one in the way to standardize?

->whereHas($belongsTo, $callback, $operator, $count);
});
}
Expand Down