public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 100) as $index) {
         Simpanan::create(['id' => $index, 'user_id' => $index, 'simpanan_wajib' => 10000, 'simpanan_sukarela' => 10000, 'pinjaman' => 20000, 'tanggal_pembayaran' => $faker->date($format = 'Y-m-d', $max = 'now'), 'created_at' => null, 'updated_at' => null]);
         $faker->unique(true);
     }
 }
 /**
  * Export the specified simpanan from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function exportdata()
 {
     // EXPORT VALIDASI
     $rules = ['tanggal_pembayaran' => 'required'];
     $messages = ['tanggal_pembayaran.required' => 'Pilih Data Tanggal Yang Akan Anda Ambil.'];
     $validator = Validator::make(Input::all(), $rules, $messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator);
     }
     $simpanans = Simpanan::where('tanggal_pembayaran', Input::get('tanggal_pembayaran'))->get();
     Excel::create('Data Simpanan', function ($excel) use($simpanans) {
         // Set the properties
         $excel->setTitle('Laporan Simpanan')->setCreator('Andreas Krisandy');
         $excel->sheet('Data Simpanan', function ($sheet) use($simpanans) {
             $row = 1;
             $sheet->row($row, array('TANGGAL PEMBAYARAN', 'NO IDENTITAS/KTP', 'AP', 'NAMA ANGGOTA', 'SIMPANAN WAJIB', 'SIMPANAN SUKARELA', 'TOTAL SIMPANAN', 'PINJAMAN'));
             foreach ($simpanans as $simpanan) {
                 $sheet->row(++$row, array($simpanan->tanggal_pembayaran, $simpanan->anggotas->no_ktp, null, $simpanan->anggotas->nama, $simpanan->simpanan_sukarela, $simpanan->simpanan_wajib, null, $simpanan->pinjaman));
             }
         });
     })->export('xls');
 }