/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $anggota = Anggota::find($id); $anggota->delete(); return redirect()->action('AnggotaController@index'); }
public function rekapexport() { //$data = \App\Keuangan::selectRaw('created_at as "Waktu",no_nota as "No. Nota", jenis as "Jenis",info as "Keterangan",masuk as "Pemasukan",keluar as "Pengeluaran"')->get(); $tgl[0] = session('tgl0'); $tgl[1] = session('tgl1'); $id_anggota = session('id_anggota'); $lama = \App\Keuangan::selectRaw('created_at as "Waktu", no_nota as "No. Nota", id_anggota, jenis as "Jenis", info as "Keterangan", masuk as "Pemasukan", keluar as "Pengeluaran"')->whereRaw('DATE_FORMAT(created_at,"%Y-%m-%d") between "' . $tgl[0] . '" and "' . $tgl[1] . '"')->where('id_koperasi', Auth::user()->assigned_koperasi)->where('id_anggota', 'like', '%' . $id_anggota . '%')->get(); $data = array(); foreach ($lama as $key) { $data[] = array('Waktu' => $key['Waktu'], 'No. Nota' => $key['No. Nota'], 'Jenis' => $key['Jenis'], 'Anggota' => \App\Anggota::find($key['id_anggota'])['nama'], 'Keterangan' => $key['Keterangan'], 'Pemasukan' => (int) $key['Pemasukan'], 'Pengeluaran' => (int) $key['Pengeluaran']); } Excel::create('Laporan Keuangan', function ($excel) use($data) { $excel->sheet('Laporan Keuangan', function ($sheet) use($data) { $sheet->fromArray($data); }); })->download('xls'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $anggota = Anggota::find($id); $nip = $anggota['nip']; $anggota->delete(); $user = DB::table('users')->where('name', $nip)->delete(); return redirect()->action('AnggotaController@index'); }