app/Http/Controllers/LevelController.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)
    {
        $this->validate($request,[
            "nama" => "required|unique:levels,nama"
        ]);
        $level = new Level;
        $level->nama = $request->nama;
        if($level->save()){
            return redirect()->route('level.index')->with(
                "success","Data berhasil disimpan");
        }
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ " nama " => " required|unique:levels,nama " ] ) ; $ level = new Level ; $ level -> nama = $ request -> nama ; if ( $ level -> save ( ) ) { return redirect ( ) -> route ( 'level.index' ) -> with ( " success " , " Data berhasil disimpan " ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .
//