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