app/Http/Controllers/KategoriController.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)
    {
        $request->validate([
            'nama'          =>  'required',
        ]);
        $kategori = new Kategori();
        $kategori->nama = $request->nama;
        $kategori->save();
        return redirect()->route('kategori.index')->with('success', 'Data kategori berhasil ditambahkan');
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'nama' => 'required' , ] ) ; $ kategori = new Kategori ( ) ; $ kategori -> nama = $ request -> nama ; $ kategori -> save ( ) ; return redirect ( ) -> route ( 'kategori.index' ) -> with ( 'success' , 'Data kategori berhasil ditambahkan' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .