Commit 13a1c5da authored by Taylor Otwell's avatar Taylor Otwell

Merge pull request #1170 from kapv89/patch-4

Added a method to fluently set belongs-to relation
parents cfc024fe 2773e317
......@@ -112,5 +112,18 @@ class Belongs_To extends Relationship {
{
return $this->base->get_attribute($this->foreign);
}
/**
* Bind an object over a belongs-to relation using its id.
*
* @return Eloquent
*/
public function bind($id)
{
$this->base->fill(array($this->foreign => $id))->save();
return $this->base;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment