title: Laravel Bulk UPDATE
body: <p>I'm trying to update a table containing a slug value with random slugs for each record.</p>
  
  <pre><code>$vouchers = Voucher-&gt;get(); // assume 10K for example
  
  foreach ($vouchers as $voucher) {
      $q .= "UPDATE vouchers set slug = '" . Str::random(32) . "' WHERE id = " . $voucher-&gt;id . ";";
  }
  
  DB::statement($q);
  </code></pre>
  
  <p>There are about 2 million records so I need to perform this as a bulk. Doing it as separate records is taking way too long. I can't seem to find a way to bulk run them, say in groups of 10K or something.</p>
  
  <p>Tried a bunch of variations of <code>-&gt;update()</code> and <code>DB::statement</code> but can't seem to get it to go.</p>