This commit is contained in:
thinkphp
2017-11-21 15:36:36 +08:00
parent c38d2a6d0d
commit e7ab1e9a2d
3 changed files with 7 additions and 7 deletions

View File

@@ -74,7 +74,7 @@ class BelongsToMany extends Relation
protected function newPivot($data = [])
{
$class = $this->pivotName ?: '\\think\\model\\Pivot';
$pivot = new $class($this->parent, $data, $this->middle);
$pivot = new $class($data, $this->parent, $this->middle);
if ($pivot instanceof Pivot) {
return $pivot;
} else {