mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
优化HasOne的has方法
This commit is contained in:
@@ -65,7 +65,7 @@ class HasOne extends OneToOne
|
|||||||
$foreignKey = $this->foreignKey;
|
$foreignKey = $this->foreignKey;
|
||||||
return $this->parent->db()->alias('a')
|
return $this->parent->db()->alias('a')
|
||||||
->whereExists(function ($query) use ($table, $localKey, $foreignKey) {
|
->whereExists(function ($query) use ($table, $localKey, $foreignKey) {
|
||||||
$query->table([$table => 'b'])->whereExp('a.' . $localKey, '=b.' . $foreignKey);
|
$query->table([$table => 'b'])->field('b.' . $foreignKey)->whereExp('a.' . $localKey, '=b.' . $foreignKey);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user