Commit 3a30bf7f authored by Jens Segers's avatar Jens Segers

Adding information about new associate and dissociate methods for embedsMany relations

parent de18ed4c
...@@ -398,6 +398,11 @@ You can remove an embedded document by using the `destroy()` method: ...@@ -398,6 +398,11 @@ You can remove an embedded document by using the `destroy()` method:
// or // or
$user->books()->destroy($book); $user->books()->destroy($book);
If you want to add or remove embedded documents, without persistence, you can use the `associate` and `dissociate` methods. To write the changes to the database, save the parent object:
$user->books()->associate($book);
$user->save();
Again, you may override the conventional local key by passing a second argument to the embedsMany method: Again, you may override the conventional local key by passing a second argument to the embedsMany method:
return $this->embedsMany('Book', 'local_key'); return $this->embedsMany('Book', 'local_key');
......
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