<?php

namespace App\Http\Controllers;

use App\Models\data_distrik_caltrans;
use App\Http\Requests\Storedata_distrik_caltransRequest;
use App\Http\Requests\Updatedata_distrik_caltransRequest;

class DataDistrikCaltransController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index()
    {
        $data_distrik=data_distrik_caltrans::all();
        return view('CalTrans.data-distrik',compact('data_distrik'));
    }

    /**
     * Show the form for creating a new resource.
     */
    public function create()
    {
        return view('CalTrans.data-distrik',[
            'data_distrik'=> data_distrik_caltrans::all()
        ]);
    }

    /**
     * Store a newly created resource in storage.
     */
    public function store(Storedata_distrik_caltransRequest $request)
    {
        $validateData=$request->validate([
            'nama_distrik'=>'required',
            'jumlah_kampung'=>'required',
            'jumlah_penduduk'=>'required'
        ]);
        data_distrik_caltrans::create($validateData);
    }

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

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

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

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