Example #1
0
 public function getDownload()
 {
     $batchid = $_GET['batchid'];
     $all_coupons = Coupon::where('batchuniqid', 'like', '%' . $batchid . '%')->get()->toArray();
     //		echo "<pre>";print_r($all_coupons);
     Excel::create('Coupons-' . date("Y-m-d", time()), function ($excel) use($all_coupons) {
         $excel->sheet('Sheetname', function ($sheet) use($all_coupons) {
             $sheet->fromArray($all_coupons);
         });
     })->export('xls')->download('xls');
     return Redirect::to('coupons.viewall')->with('coupons', Coupon::orderBy('created_at', 'DESC')->groupBy('batchuniqid')->paginate(10, $fields));
 }