app/Http/Controllers/MuridController.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)
    {
        $data = $request->validate([
            'nis'=>'required|unique:murids',
            'nama_murid'=>'required|string',
            'kelas_id'=>'required|string',
            'gender'=>'required|string',
            'tanggal_lahir'=>'required|date',
            'alamat'=>'required|string',
            'nomor_telp'=>'required'
        ]);
        Murid::create([
            'nis'=>$data['nis'],
            'nama_murid'=>$data['nama_murid'],
            'kelas_id'=>$data['kelas_id'],
            'gender'=>$data['gender'],
            'tanggal_lahir'=>$data['tanggal_lahir'],
            'alamat'=>$data['alamat'],
            'nomor_telp'=>$data['nomor_telp']
        ]);
        return redirect()->route('murid.index');
    }
public function store ( Request $ request ) { $ data = $ request -> validate ( [ 'nis' => 'required|unique:murids' , 'nama_murid' => 'required|string' , 'kelas_id' => 'required|string' , 'gender' => 'required|string' , 'tanggal_lahir' => 'required|date' , 'alamat' => 'required|string' , 'nomor_telp' => 'required' ] ) ; Murid :: create ( [ 'nis' => $ data [ 'nis' ] , 'nama_murid' => $ data [ 'nama_murid' ] , 'kelas_id' => $ data [ 'kelas_id' ] , 'gender' => $ data [ 'gender' ] , 'tanggal_lahir' => $ data [ 'tanggal_lahir' ] , 'alamat' => $ data [ 'alamat' ] , 'nomor_telp' => $ data [ 'nomor_telp' ] ] ) ; return redirect ( ) -> route ( 'murid.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// Murid::create($request->all());