public function getEdit($id) { $data['provinsi'] = Provinsi::all(); $data['kabupaten'] = Kabupaten::all(); $data['kecamatan'] = Kecamatan::all(); $data['desa'] = Desa::all(); $data['mangroverehabilitasi'] = MangroveRehabilitasi::find($id); return view('app.mangrove.rehabilitasi.update', $data); }
public function getEdit($id) { $data['provinsi'] = Provinsi::all(); $data['kabupaten'] = Kabupaten::all(); $data['kecamatan'] = Kecamatan::all(); $data['desa'] = Desa::all(); $data['jumlahpenduduk'] = JumlahPenduduk::find($id); return view('app.jumlah-penduduk.update', $data); }
public function getEdit($id) { $data['provinsi'] = Provinsi::all(); $data['kabupaten'] = Kabupaten::all(); $data['kecamatan'] = Kecamatan::all(); $data['desa'] = Desa::all(); $data['terumburehabilitasi'] = TerumbuRehabilitasi::find($id); return view('app.terumbu.rehabilitasi.update', $data); }
public function getDetailDesa($id) { $data['desa'] = Desa::find($id); $data['airtawar'] = AirTawar::where('desa', $id)->get(); $data['rumputlaut'] = RumputLaut::where('desa', $id)->get(); $data['tambak'] = Tambak::where('desa', $id)->get(); $data['mangrovemilik'] = MangroveMilik::where('desa', $id)->get(); $data['mangroverehabilitasi'] = MangroveRehabilitasi::where('desa', $id)->get(); $data['terumbumilik'] = TerumbuMilik::where('desa', $id)->get(); $data['terumburehabilitasi'] = TerumbuRehabilitasi::where('desa', $id)->get(); return view('app.statistik.detail-desa', $data); }
public function getUpdate(Request $r) { foreach ($r->id_desa as $key => $id_desa) { $cek = Desa::where('id', $r->desa[$key])->where('id', '<>', $id_desa)->count(); if ($cek > 0) { \Session::flash('gagal', 'Gagal!! Pastikan ID DESA tidak ada yang sama'); return redirect()->back(); } } DB::transaction(function () use($r) { $table = ['app_air_tawar', 'app_tambak', 'app_mangrove_milik', 'app_mangrove_rehabilitasi', 'app_pemasar', 'app_rumput_laut', 'app_terumbu_milik', 'app_terumbu_rehabilitasi']; foreach ($r->id_desa as $key => $id_desa) { $save = DB::table('desa')->where('id', $id_desa)->update(['id' => $r->desa[$key]]); foreach ($table as $val) { DB::table($val)->where('desa', $id_desa)->update(['desa' => $r->desa[$key]]); } } }); \Session::flash('success', 'Berhasil mengubah data'); return redirect()->back(); }
}); Route::resources(['provinsi' => 'ProvinsiController', 'kabupaten' => 'KabupatenController', 'kecamatan' => 'KecamatanController', 'desa' => 'DesaController']); Route::get('get/{region}/{id}', ['as' => 'getRegion', 'uses' => function ($r, $id) { $data = []; if ($r == 'kabupaten') { foreach (\App\Kabupaten::where('provinsi_id', $id)->get() as $list) { $data = array_merge_recursive($data, [['id' => $list->id, 'text' => $list->label]]); } } if ($r == 'kecamatan') { foreach (\App\Kecamatan::where('kabupaten_id', $id)->get() as $list) { $data = array_merge_recursive($data, [['id' => $list->id, 'text' => $list->label]]); } } if ($r == 'desa') { foreach (\App\Desa::where('kecamatan_id', $id)->get() as $list) { $data = array_merge_recursive($data, [['id' => $list->id, 'text' => $list->label]]); } } return $data; }]); }); }); Route::group(['prefix' => 'admin/kecamatan', 'middleware' => 'UAC:kecamatan', 'namespace' => 'Admin\\Kecamatan'], function () { Route::get('/', ['as' => 'admin.kecamatan.landing', 'uses' => function () { return view('admin_template'); }]); Route::get('get_bantuan', ['as' => 'getBantuan', 'uses' => 'PenerimaBantuanController@getBantuan']); Route::get('get_kriteria', ['as' => 'getKI', 'uses' => 'PenerimaBantuanController@getKI']); Route::resources(['penduduk' => 'PendudukController', 'penerima' => 'PenerimaBantuanController', 'generate' => 'GeneratorController']); });