Closed
Description
I have User and Role models, with each one having a belongsToMany relationship with the other, i.e. User belongsToMany Role and Role belongsToMany User.
Consider the following example:
$user = User::find("5294f9d695463439088b4569");
$user->roles()->sync(array("52953c599546345b048b456a", "52953c599546345b048b456b"));
// the above code puts the Role id's on the User document, as expected.
// it also puts the User id on the Role documents, as expected.
// later on...
$user->roles()->sync(array());
// that line removes the Role ids from the User document
// but it does not remove the User id from the Role documents
Shouldn't the User id be removed from the Role documents when the sync method passes an empty array? Or is that not what sync is meant to do?
Metadata
Metadata
Assignees
Labels
No labels