laravel/framework — pull request #2656 by arvidbjorkstrom (2013-11-06 09:58:47+00:00)
Title: [Proposal] Let BelongsToMany->sync return affected IDs 

I think a useful feature would be if the sync method somehow returned the IDs of the relationships affected by the sync.

The only way I could think of would be to return an array containing sub-arrays like this
```php
array(
// The IDs that were newly attached because of the sync
'attached' => array(1,2,3),

// The IDs that were detached during the sync
'detached' => array(4,5),

// The synced IDs that already existed, but had attributes,
// thus being updated
'updated' => array(6,7)
);
```
This solution feels a little clumsy, and not that elegant, but it's the simplest solution I've come to think of yet.