$path = storage_path('app/_fixup_corrections.json'); $data = json_decode(file_get_contents($path), true); $upd=0;$skip=0; foreach ($data as $c) { if (($c['action'] ?? '') !== 'fix') { $skip++; continue; } if (empty($c['id']) || !isset($c['question'])) { $skip++; continue; } DB::table('questions')->where('id',$c['id'])->update(['question'=>$c['question'],'updated_at'=>now()]); $upd++; } echo "updated=$upd skipped=$skip\n";