selectRaw('word,count(*)')->groupBy('word')->cursor(); $bar = $this->output->createProgressBar(230000); foreach ($words as $word) { $update = Vocabulary::firstOrNew( ['word' => $word->word], ['word_en'=>Tools::getWordEn($word->word)] ); $update->count = $word->count; $update->flag = 1; $update->strlen = mb_strlen($word->word,"UTF-8"); $update->save(); $bar->advance(); } $bar->finish(); Vocabulary::where('flag',0)->delete(); return 0; } }