增加Pivot对象parent属性

This commit is contained in:
yunwuxin
2017-03-02 16:06:37 +08:00
parent 6d2541585d
commit 0952e9231f
2 changed files with 10 additions and 4 deletions

View File

@@ -64,7 +64,7 @@ class BelongsToMany extends Relation
protected function newPivot($data)
{
$pivot = $this->pivot ?: '\\think\\model\\Pivot';
return new $pivot($data, $this->middle);
return new $pivot($this->parent, $data, $this->middle);
}
/**