title: update multiple data if exists, create if does not exist in laravel
body: <p>I want to insert or update multiple rows. if some data already exists then it will update otherwise it will create new items. My code from are :</p>
  <pre><code>foreach ($product_id as $key =&gt; $value) {
      $input['product_name'] = $request-&gt;product_name[$key];
      $input['product_price'] = $request-&gt;product_price[$key];
  
      $add_product = Product::upsert($input,'product_name');
  }
  </code></pre>
  <p>I am not getting any error, Its just inserting all data instead of updating the existing items.</p>