app/Http/Controllers/KelasController.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([
            'kelas'=>'required|string',
            'jurusan_kelas'=>'required|string',
            'wali_kelas'=>'required|unique:kelas'
        ]);
        Kelas::create([
            'kelas'=>$data['kelas'],
            'jurusan_kelas'=>$data['jurusan_kelas'],
            'wali_kelas'=>$data['wali_kelas']
        ]);
        return redirect()->route('kelas.index');
    }
public function store ( Request $ request ) { $ data = $ request -> validate ( [ 'kelas' => 'required|string' , 'jurusan_kelas' => 'required|string' , 'wali_kelas' => 'required|unique:kelas' ] ) ; Kelas :: create ( [ 'kelas' => $ data [ 'kelas' ] , 'jurusan_kelas' => $ data [ 'jurusan_kelas' ] , 'wali_kelas' => $ data [ 'wali_kelas' ] ] ) ; return redirect ( ) -> route ( 'kelas.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// Kelas::create($request->all());