修正has方法

This commit is contained in:
thinkphp
2017-10-30 11:00:56 +08:00
parent d6118aa53e
commit 5b15364fd2

View File

@@ -74,7 +74,7 @@ class HasOne extends OneToOne
return $this->parent->db()
->alias($model)
->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) {
$query->table([$table => $relation])->field($relation . '.' . $foreignKey)->whereExp($model . '.' . $localKey, '=' . $relatoin . '.' . $foreignKey);
$query->table([$table => $relation])->field($relation . '.' . $foreignKey)->whereExp($model . '.' . $localKey, '=' . $relation . '.' . $foreignKey);
});
}