mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-05 22:52:49 +08:00
改进关联模型
This commit is contained in:
@@ -50,7 +50,13 @@ class BelongsTo extends OneToOne
|
||||
if ($closure) {
|
||||
call_user_func_array($closure, [ & $this->query]);
|
||||
}
|
||||
return $this->query->where($this->localKey, $this->parent->$foreignKey)->relation($subRelation)->find();
|
||||
$relationModel = $this->query
|
||||
->where($this->localKey, $this->parent->$foreignKey)
|
||||
->relation($subRelation)
|
||||
->find();
|
||||
$relationModel->setParent(clone $this->parent);
|
||||
|
||||
return $relationModel;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user