where('id', '>', 0) ->chunkById(10, function ($transactions) { foreach ($transactions as $transaction) { Transaction::query() ->where('id', '=', $transaction->id) ->update([ 'date' => Carbon::now(), 'value' => 1, ]); } }); } }