title: Reduce time for update query in Laravel (without for loop, for same key and multiple values)
body: <pre><code>for ($i = 0; $i &lt; count($ids); $i++) {
      ls_player_details::where('Bib_no', $ids[$i])-&gt;update(['chestno' =&gt; $chestnos[$i]]);
  }
  </code></pre>
  
  <p>This update query takes 8secs for 162 records, so want to reduce the time </p>
  
  <p><strong>So i made this one;</strong></p>
  
  <pre><code>for ($i = 0; $i &lt; count($chestnos); $i++) {
      $data[] = array('chestno' =&gt; $chestnos[$i]);
  }
  
  ls_player_details::whereIn('Bib_no', $ids)-&gt;update($data);
  </code></pre>
  
  <p><strong>now what's the problem is;</strong></p>
  
  <p>now i getting <strong>data</strong> like this</p>
  
  <pre><code>[ 
      {
          "chestno": 50
      },
      {
          "chestno": 51
      },
      {
          "chestno": 52
      },
      {
          "chestno": 53
      },
      {
          "chestno": 54
      },
      {
          "chestno": 55
      },
  ]
  </code></pre>
  
  <p><strong>But i want to get array like;</strong></p>
  
  <pre><code>["chestno": 50,"chestno": 50,"chestno": 50]
  </code></pre>
  
  <p><strong>problem:</strong></p>
  
  <p>Pushing multiple values for same key in to array using for loop,</p>
  
  <p>And i want to know there is any other method to done the same thing. </p>