<?php

namespace App\Http\Controllers;

use App\Models\data_pribadi_bumdes;
use App\Http\Requests\Storedata_pribadi_bumdesRequest;
use App\Http\Requests\Updatedata_pribadi_bumdesRequest;

class DataPribadiBumdesController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index()
    {
        $data_pribadi=data_pribadi_bumdes::all();
        return view('BumDes.index',compact('data_pribadi'));
    }

    /**
     * Show the form for creating a new resource.
     */
    public function create()
    {
        return view('BumDes.index',[
            'data_pribadi'=>data_pribadi_bumdes::all()
        ]);
    }

    /**
     * Store a newly created resource in storage.
     */
    public function store(Storedata_pribadi_bumdesRequest $request)
    {
        $validateData=$request->validate([
            'nip' => 'required|unique:data_pribadi_kpmds',
            'nama_lengkap'=>'required',
            'pangkat'=>'required',
            'jabatan'=>'required',
            'instansi'=>'required',
            'kabupaten'=>'required',
            'phone_number'=>'required',
            'pesan'=>'required',
            'alamat'=>'required'
        ]);
        data_pribadi_bumdes::create($validateData);
        return redirect('/data-distrik-bumdes');
    }

    /**
     * Display the specified resource.
     */
    public function show(data_pribadi_bumdes $data_pribadi_bumdes)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     */
    public function edit(data_pribadi_bumdes $data_pribadi_bumdes)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     */
    public function update(Updatedata_pribadi_bumdesRequest $request, data_pribadi_bumdes $data_pribadi_bumdes)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     */
    public function destroy(data_pribadi_bumdes $data_pribadi_bumdes)
    {
        //
    }
}
