app/Http/Controllers/LongsorController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request, $tahun)
    {
        $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',
		]);
        $longsor = new Longsor();
		$longsor->id_tahun = $tahun;
		$longsor->uuid = Uuid::uuid4()->getHex();
		$longsor->alamat = $request->alamat;
		$longsor->kecamatan = $request->kecamatan;
		$longsor->tgl = $request->tgl;
		$longsor->kb_meninggal = $request->kb_meninggal;
		$longsor->kb_hilang = $request->kb_hilang;
		$longsor->kb_luka = $request->kb_luka;
		$longsor->kb_mengungsi = $request->kb_mengungsi;
		$longsor->kr_rumah_rb = $request->kr_rumah_rb;
		$longsor->kr_rumah_rr = $request->kr_rumah_rr;
		$longsor->kr_rumah_terendam = $request->kr_rumah_terendam;
		$longsor->kantor = $request->kantor;
		$longsor->sekolah = $request->sekolah;
		$longsor->t_ibadah = $request->t_ibadah;
        $longsor->sarana_kesehatan = $request->sarana_kesehatan;
        $longsor->bangunan_lain = $request->bangunan_lain;
        $longsor->jembatan = $request->jembatan;
        $longsor->jalan = $request->jalan;
        $longsor->sawah = $request->sawah;
        $longsor->hutan = $request->hutan;
		$longsor->save();
		return redirect()->route('tahun.longsor.index', $tahun)->with('success', 'data successfully added');
    }
public function store ( Request $ request , $ tahun ) { $ 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' , ] ) ; $ longsor = new Longsor ( ) ; $ longsor -> id_tahun = $ tahun ; $ longsor -> uuid = Uuid :: uuid4 ( ) -> getHex ( ) ; $ longsor -> alamat = $ request -> alamat ; $ longsor -> kecamatan = $ request -> kecamatan ; $ longsor -> tgl = $ request -> tgl ; $ longsor -> kb_meninggal = $ request -> kb_meninggal ; $ longsor -> kb_hilang = $ request -> kb_hilang ; $ longsor -> kb_luka = $ request -> kb_luka ; $ longsor -> kb_mengungsi = $ request -> kb_mengungsi ; $ longsor -> kr_rumah_rb = $ request -> kr_rumah_rb ; $ longsor -> kr_rumah_rr = $ request -> kr_rumah_rr ; $ longsor -> kr_rumah_terendam = $ request -> kr_rumah_terendam ; $ longsor -> kantor = $ request -> kantor ; $ longsor -> sekolah = $ request -> sekolah ; $ longsor -> t_ibadah = $ request -> t_ibadah ; $ longsor -> sarana_kesehatan = $ request -> sarana_kesehatan ; $ longsor -> bangunan_lain = $ request -> bangunan_lain ; $ longsor -> jembatan = $ request -> jembatan ; $ longsor -> jalan = $ request -> jalan ; $ longsor -> sawah = $ request -> sawah ; $ longsor -> hutan = $ request -> hutan ; $ longsor -> save ( ) ; return redirect ( ) -> route ( 'tahun.longsor.index' , $ tahun ) -> with ( 'success' , 'data successfully added' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// dd($request); // dd($uuid); // dd($longsor);