<?php

namespace App\Http\Controllers;

use App\Models\potensi_sdm;
use App\Http\Requests\Storepotensi_sdmRequest;
use App\Http\Requests\Updatepotensi_sdmRequest;

class PotensiSdmController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index()
    {
        $potensi_sdm=potensi_sdm::all();
        return view('SDM.create',compact('potensi_sdm'));
    }

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

    /**
     * Store a newly created resource in storage.
     */
    public function store(Storepotensi_sdmRequest $request)
    {
        $validateData=$request->validate([
            'sumber_daya'=>'required|unique:potensi_sdms'
        ]);
        // dd($validateData);
        potensi_sdm::create($validateData);
        return redirect('/');
    }

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

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

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

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