app/Http/Controllers/LongsorController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Longsor  $longsor
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $idtahun, $idlongsor)
    {
		$this->validate($request, [
			'alamat' => 'required',
			'kecamatan' => 'required',
			'tgl' => 'required',
			'kb_meninggal' => 'required',
			'kb_hilang' => 'required',
			'kb_luka' => 'required',
			'kb_mengungsi' => 'required',
			'kr_rumah_rb' => 'required',
			'kr_rumah_rr' => 'required',
			'kr_rumah_terendam' => 'required',
			'kantor' => 'required',
			'sekolah' => 'required',
			't_ibadah' => 'required',
			'sarana_kesehatan' => 'required',
			'bangunan_lain' => 'required',
			'jembatan' => 'required',
			'jalan' => 'required',
			'sawah' => 'required',
			'hutan' => 'required',
		]);
        $data = Longsor::whereUuid($idlongsor)->firstOrFail();
		$data->alamat = request('alamat');
		$data->kecamatan = request('kecamatan');
		$data->tgl = request('tgl');
		$data->kb_meninggal = request('kb_meninggal');
		$data->kb_hilang = request('kb_hilang');
		$data->kb_luka = request('kb_luka');
		$data->kb_mengungsi = request('kb_mengungsi');
		$data->kr_rumah_rb = request('kr_rumah_rb');
		$data->kr_rumah_rr = request('kr_rumah_rr');
		$data->kr_rumah_terendam = request('kr_rumah_terendam');
		$data->kantor = request('kantor');
		$data->sekolah = request('sekolah');
		$data->t_ibadah = request('t_ibadah');
		$data->sarana_kesehatan = request('sarana_kesehatan');
		$data->bangunan_lain = request('bangunan_lain');
		$data->jembatan = request('jembatan');
		$data->jalan = request('jalan');
		$data->sawah = request('sawah');
		$data->hutan = request('hutan');
		$data->update();
		return redirect()->route('tahun.longsor.index', $idtahun)->with('success', 'data successfully updated');
    }
public function update ( Request $ request , $ idtahun , $ idlongsor ) { $ this -> validate ( $ request , [ 'alamat' => 'required' , 'kecamatan' => 'required' , 'tgl' => 'required' , 'kb_meninggal' => 'required' , 'kb_hilang' => 'required' , 'kb_luka' => 'required' , 'kb_mengungsi' => 'required' , 'kr_rumah_rb' => 'required' , 'kr_rumah_rr' => 'required' , 'kr_rumah_terendam' => 'required' , 'kantor' => 'required' , 'sekolah' => 'required' , 't_ibadah' => 'required' , 'sarana_kesehatan' => 'required' , 'bangunan_lain' => 'required' , 'jembatan' => 'required' , 'jalan' => 'required' , 'sawah' => 'required' , 'hutan' => 'required' , ] ) ; $ data = Longsor :: whereUuid ( $ idlongsor ) -> firstOrFail ( ) ; $ data -> alamat = request ( 'alamat' ) ; $ data -> kecamatan = request ( 'kecamatan' ) ; $ data -> tgl = request ( 'tgl' ) ; $ data -> kb_meninggal = request ( 'kb_meninggal' ) ; $ data -> kb_hilang = request ( 'kb_hilang' ) ; $ data -> kb_luka = request ( 'kb_luka' ) ; $ data -> kb_mengungsi = request ( 'kb_mengungsi' ) ; $ data -> kr_rumah_rb = request ( 'kr_rumah_rb' ) ; $ data -> kr_rumah_rr = request ( 'kr_rumah_rr' ) ; $ data -> kr_rumah_terendam = request ( 'kr_rumah_terendam' ) ; $ data -> kantor = request ( 'kantor' ) ; $ data -> sekolah = request ( 'sekolah' ) ; $ data -> t_ibadah = request ( 't_ibadah' ) ; $ data -> sarana_kesehatan = request ( 'sarana_kesehatan' ) ; $ data -> bangunan_lain = request ( 'bangunan_lain' ) ; $ data -> jembatan = request ( 'jembatan' ) ; $ data -> jalan = request ( 'jalan' ) ; $ data -> sawah = request ( 'sawah' ) ; $ data -> hutan = request ( 'hutan' ) ; $ data -> update ( ) ; return redirect ( ) -> route ( 'tahun.longsor.index' , $ idtahun ) -> with ( 'success' , 'data successfully updated' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
// dd($request); // dd($data); // $input = $request->all(); // $data->save('data'); // $data->update($input); // Longsor::whereUuid($idlongsor)->update($data); // dd($data);