Fix pivot constraints on ->pivot() method of many-to-many.

Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
This commit is contained in:
Taylor Otwell 2012-03-22 21:47:35 -05:00
parent 879e56df75
commit 57cf817de4
1 changed files with 5 additions and 1 deletions

View File

@ -341,7 +341,11 @@ public function with($columns)
*/ */
public function pivot() public function pivot()
{ {
return new Pivot($this->joining); $key = $this->base->get_key();
$foreign = $this->foreign_key();
return with(new Pivot($this->joining))->where($foreign, '=', $key);
} }
/** /**