put($filename, ""); $file = fopen(storage_path("app/{$filename}"),"w"); fputcsv($file,['id','book','paragraph','level','toc','length','chapter_len','next_chapter','prev_chapter','parent','chapter_strlen']); $bar = $this->output->createProgressBar(PaliText::count()); foreach (PaliText::select(['uid','book','paragraph','level','toc','lenght','chapter_len','next_chapter','prev_chapter','parent','chapter_strlen']) ->orderBy('book') ->orderBy('paragraph') ->cursor() as $chapter) { fputcsv($file,[ $chapter->uid, $chapter->book, $chapter->paragraph, $chapter->level, $chapter->toc, $chapter->lenght, $chapter->chapter_len, $chapter->next_chapter, $chapter->prev_chapter, $chapter->parent, $chapter->chapter_strlen, ]); $bar->advance(); } fclose($file); $bar->finish(); return 0; } }