Return a query that includes pivot data for belongsToMany relations

This commit is contained in:
Samuel Georges 2015-02-28 22:08:25 +11:00
parent 81d0225928
commit ce77c0f89e
1 changed files with 5 additions and 0 deletions

View File

@ -969,6 +969,11 @@ class RelationController extends ControllerBehavior
elseif ($this->model->exists) {
$this->relationObject->addConstraints();
}
if ($this->relationType == 'belongsToMany') {
$this->relationObject->setQuery($query->getQuery());
return $this->relationObject;
}
});
/*