groupBy('language')->get(); $languages = []; foreach ($langInDict as $lang) { if(!empty($lang["language"])){ $languages[] = $lang["language"]; } } print_r($languages); foreach ($languages as $thisLang) { Log::info("running $thisLang"); $bar = $this->output->createProgressBar(UserDict::where('source','_PAPER_') ->where('language',$thisLang)->count()); foreach (UserDict::where('source','_PAPER_') ->where('language',$thisLang) ->select('word','note') ->cursor() as $word) { Cache::put("dict_first_mean/{$thisLang}/{$word['word']}", mb_substr($word['note'],0,50,"UTF-8") ,24*3600); $bar->advance(); } $bar->finish(); } Log::info("running com"); $bar = $this->output->createProgressBar(UserDict::where('source','_PAPER_')->count()); foreach (UserDict::where('source','_PAPER_') ->select('word','note') ->cursor() as $word) { $key = "dict_first_mean/com/{$word['word']}"; Cache::put($key, mb_substr($word['note'],0,50,"UTF-8") ,24*3600); $bar->advance(); } $bar->finish(); return 0; } }