title: Laravel Many to Many sync with null
body: <p>I'm trying to use sync function like that:</p>
  
  <pre><code>$round-&gt;competitors()-&gt;sync($fighters);
  </code></pre>
  
  <p>$fighter is : </p>
  
  <pre><code>Collection {#339 ▼
    #items: array:3 [▼
      0 =&gt; 5
      1 =&gt; null
      2 =&gt; 6
    ]
  }
  </code></pre>
  
  <p>When it get to the null element, I get :</p>
  
  <pre><code>QueryException in Connection.php line 647:
  SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column 'competitor_id' at row 1 (SQL: insert into `round_competitor` (`competitor_id`, `round_id`) values (, 29))
  </code></pre>
  
  <p>I get the same result if I try:</p>
  
  <pre><code>$round-&gt;competitors()-&gt;sync([null, null]);
  </code></pre>
  
  <p>But if I try:</p>
  
  <pre><code>$round-&gt;competitors()-&gt;attach(null);
  </code></pre>
  
  <p>it works without any problem???</p>
  
  <p>Why is that happening???</p>