This commit is contained in:
thinkphp
2016-12-22 23:40:15 +08:00
parent 35d2c6552c
commit 6433f8fdca

View File

@@ -239,7 +239,7 @@ class BelongsToMany extends Relation
$result = false;
foreach ($dataSet as $key => $data) {
if (!$samePivot) {
$pivot = !empty($pivot) ? $pivot[$key] : [];
$pivot = isset($pivot[$key]) ? $pivot[$key] : [];
}
$result = $this->attach($data, $pivot);
}