title: laravel query update with multiple condition
body: <p>I have column named <code>flag</code> and I want to update it if value is <code>1</code> to <code>null</code> and if value is <code>null</code> to <code>1</code> so far is easy to update this column but issue comes where I send multiple data to controller and not only one.</p>
  
  <h1>code</h1>
  
  <pre><code>public function flagmultiplemessage(Request $request){
    $ids = $request-&gt;input('ids');
    DB::table('messages')-&gt;whereIn('id', $ids)
    -&gt;whereNotNull('messages.flag')-&gt;update(['flag' =&gt; null])
    -&gt;whereNull('messages.flag')-&gt;update(['flag' =&gt; '1']);
  }
  </code></pre>
  
  <p>with function above i get:</p>
  
  <pre><code>message Call to a member function whereNull() on integer
  </code></pre>
  
  <h1>dd</h1>
  
  <p>code above is something like this:</p>
  
  <pre><code>ids = [11, 12, 3]
  database = [
    11-&gt;flag = 1,
    12-&gt;flag = null,
    3-&gt;flag = 1,
  ]
  </code></pre>
  
  <p>the result of code above most change my database like:</p>
  
  <pre><code>database = [
    11-&gt;flag = null,
    12-&gt;flag = 1,
    3-&gt;flag = null,
  ]
  </code></pre>
  
  <p><strong>any idea why i get error?</strong></p>