Skip to content

Commit

Permalink
Added note about syncing with pivot data. Closes laravel#267.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed May 28, 2013
1 parent 976e154 commit ea644aa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,12 @@ You may also use the `sync` method to attach related models. The `sync` method a

$user->roles()->sync(array(1, 2, 3));

You may also associate other pivot table values with the given IDs:

**Adding Pivot Data When Syncing**

$user->roles()->sync(array(1 => array('expires' => true)));

Sometimes you may wish to create a new related model and attach it in a single command. For this operation, you may use the `save` method:

$role = new Role(array('name' => 'Editor'));
Expand Down

0 comments on commit ea644aa

Please sign in to comment.