title: Update data from a query using multiple where in laravel
body: <p>I have a 2d array input like this:</p>
  
  <pre><code>[ 6 =&gt; [ [2=&gt;3, 5=&gt;7] ],
    8 =&gt; [ [1=&gt;4, 9=&gt;3] ],
    .....
  ]
  </code></pre>
  
  <p>The 6,8 are locationIDs and 2,5,1,9 are variantIDs and 3,4,7,3 are their respective quantities. I have to loop through the 2d array and get the data. The table has the fields location_id, variant_id and quantity. </p>
  
  <pre><code>    $variantsData  = self::where(function ($query) use ($inventoryData) {
          foreach ($inventoryData as $location =&gt; $variantData) {
              foreach ($variantData as $variant =&gt; $quantity) {
                  $query-&gt;orWhere(function ($query) use ($location, $variant) {
                      $query-&gt;where('location_id', $location)
                          -&gt;where('variant_id', $variant);
                  });
              }
          }
      })-&gt;get();
  </code></pre>
  
  <p>The $inventoryData is the 2d array. I get the data required in this code but now I need to update the quantity by adding the stored quantity with this one in the array.</p>