title: How to use sync() with additional pivot fields [Laravel 5]
body: <p>Here is my code:</p>
  
  <pre><code>public function updateGroupIntoDatabase(){
  
      $group_id = 6;
      $group = Group::find($group_id);
      $group -&gt; name = Input::get('groups');
      $projectsIds = Input::get('projects');
  
      $userIds = array_merge(Input::get('clients'),Input::get('workers'));
      array_push($userIds, Auth::id());
      $adminId = Auth::id();
      if($group -&gt; save()){
      foreach($userIds as $userId){
  
         $name = User::find($userId);
  
         $group -&gt; projects() -&gt; sync($projectsIds,array('admin_id' =&gt; $adminId, 'user_id' =&gt; $userId,'user_name' =&gt; $name -&gt; name));
  
      }
  </code></pre>
  
  <p>when I execute this I get like this:</p>
  
  <pre><code>id  project_id  group_id admin_id user_id  user_name
  1   4           6        0        0
  </code></pre>
  
  <p>But it should for each <code>user_id</code> create new record... When I use attach method It works find but when I use sync it create just one record with additional pivot fields filds <code>0</code>. Any solution for this?</p>