put("public/export/sentence.csv", ""); $file = fopen(storage_path('app/public/export/sentence.csv'),"w"); fputcsv($file,['id','book','paragraph','word_start','word_end','content','content_type','html','channel_id','editor_id','language','updated_at']); $bar = $this->output->createProgressBar(Sentence::where('status',30)->count()); foreach (Sentence::where('status',30)->select(['uid','book_id','paragraph','word_start','word_end','content','content_type','channel_uid','editor_uid','language','updated_at'])->cursor() as $chapter) { fputcsv($file,[ $chapter->uid, $chapter->book_id, $chapter->paragraph, $chapter->word_start, $chapter->word_end, $chapter->content, $chapter->content_type, $chapter->content, $chapter->channel_uid, $chapter->editor_uid, $chapter->language, $chapter->updated_at, ]); $bar->advance(); } fclose($file); $bar->finish(); return 0; } }