改进多对多的数据更新

This commit is contained in:
thinkphp
2017-06-05 11:24:33 +08:00
parent e5a24df10d
commit 08e42118f6

View File

@@ -93,7 +93,7 @@ class BelongsToMany extends Relation
} }
} }
} }
$model->pivot = $this->newPivot($pivot); $model->setRelation('pivot', $this->newPivot($pivot));
} }
} }
@@ -359,7 +359,7 @@ class BelongsToMany extends Relation
} }
} }
} }
$set->pivot = $this->newPivot($pivot); $set->setRelation('pivot', $this->newPivot($pivot));
$data[$pivot[$this->localKey]][] = $set; $data[$pivot[$this->localKey]][] = $set;
} }
return $data; return $data;