put($filename, ""); $file = fopen(storage_path("app/{$filename}"),"w"); fputcsv($file,['id','book','paragraph','language','title','channel_id','progress','updated_at']); $bar = $this->output->createProgressBar(ProgressChapter::count()); foreach (ProgressChapter::select(['uid','book','para','lang','title','channel_id','progress','updated_at'])->cursor() as $chapter) { fputcsv($file,[ $chapter->uid, $chapter->book, $chapter->para, $chapter->lang, $chapter->title, $chapter->channel_id, $chapter->progress, $chapter->updated_at, ]); $bar->advance(); } fclose($file); $bar->finish(); return 0; } }