<?php

namespace App\Http\Controllers;

use App\Models\data_pribadi_kpmd;
use App\Http\Requests\Storedata_pribadi_kpmdRequest;
use App\Http\Requests\Updatedata_pribadi_kpmdRequest;

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

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

    /**
     * Store a newly created resource in storage.
     */
    public function store(Storedata_pribadi_kpmdRequest $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_kpmd::create($validateData);
        return redirect('/data-distrik-kpmd');
    }

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

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

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

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