middleware('auth'); } /** * Show the application dashboard. * * @return \Illuminate\View\View */ public function index() { $data['menu'] = 'Manajemen Pengguna'; $data['current_page'] = 'data-divisi'; $data['divisi'] = Divisi::all(); return view('admin.divisi.index',$data); } public function update_ajax(Request $request){ $data_update = array( 'nama_divisi' => $request->nama_divisi ); $id = $request->id; $update = DB::table('tbl_divisi')->where('id',$id)->update($data_update); if($update){ return redirect('divisi')->with('sukses','Data Divisi Berhasil di update ...'); }else{ return redirect('divisi')->with('error','Data Divisi Gagal di update ....'); } } public function hapus($id){ $hapus = DB::table('tbl_divisi')->where('id',$id)->delete(); if($hapus){ return redirect('divisi')->with('sukses','Data Divisi Berhasil di hapus ...'); }else{ return redirect('divisi')->with('error','Data Divisi Gagal di hapus ....'); } } public function store(Request $request){ $data = array( 'nama_divisi' => $request->nama_divisi ); $insert = DB::table('tbl_divisi')->insert($data); if($insert){ return redirect('divisi')->with('sukses', 'Data Divisi Berhasil di tambahkan ..'); }else{ return redirect('divisi')->with('error', 'Data Divisi Gagal di tambahkan ..'); } } }