0

I am trying to create a csv file with 100 000 records in ,but it is timing out. If i run 10 000 records it works fine.

$users1 = Aapplicant::select(DB::raw('applicant.AppID as Application_ID,
                        tapplicant.Email,
                        tapplicant.AppDate as Application_Date,
                        tapplicant.AppIPAddress as IP_Address,
                        tapplicant.AppAffID as Affiliate_ID,
                        toutcome.Status as Application_Status,'))
                        ->join('outcome', 'outcome.AppID', '=', 'applicant.AppID')
 ->where('AppDate', '>=', \Carbon\Carbon::now()->startOfMonth())                            
->orderBy('tapplicant.AppID', 'DESC')
                            ->get();

Excel::create('tapplicant', function($excel) use($users1) {

                        $excel->sheet('Sheet 1', function($sheet) use($users1) {

                            $sheet->fromArray($users1);

                        });

                    })->store('csv');
Jack
  • 21
  • 4
  • you should not perform such actions on runtime, what you should do it queue them to be processed in the background see https://laravel.com/docs/5.3/queues – Khan Shahrukh Jan 20 '17 at 13:16
  • @KhanShahrukh , the above is only executed once someone pushes the export button. I should have mentioned that. – Jack Jan 20 '17 at 16:09

0 Answers0