title: Laravel 5.4 How to update pivot table?
body: <p>I have next structure pivot table: products_equipment_value(id, product_id, equipment_id, value_id).How to update table fields equipment_id and value_id ?</p>
  
  <pre><code> public function equipments()
      {
          return $this-&gt;belongsToMany('App\Equipment', ' product_equipment_value');
      }
  
      public function values()
      {
          return $this-&gt;belongsToMany('App\Value', ' product_equipment_value', 'product_id', 'value_id')
      }
  </code></pre>
  
  <p>Use(not work)</p>
  
  <pre><code> $product-&gt;equipments()-&gt;detach();
         foreach($data['eq'] as $key =&gt; $val){
           $product-&gt;equipments()-&gt;attach([
             'equipment_id' =&gt;  $key,
              'value_id' =&gt;$val
            ]);
        }
  </code></pre>