app/Http/Controllers/CategoryController.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 = new Category();
        $data->kategori_buku = $request->kategori_buku;
        $data->slug = $request->slug;
        $simpan = $data->save();
        if ($simpan) {
            return response()->json(['data' => $data, 'text' => 'Data Berhasil Disimpan'], 200);
        } else {
            return response()->json(['data' => $data, 'text' => 'Data Gagal Disimpan']);
        }
    }
public function store ( Request $ request ) { $ data = new Category ( ) ; $ data -> kategori_buku = $ request -> kategori_buku ; $ data -> slug = $ request -> slug ; $ simpan = $ data -> save ( ) ; if ( $ simpan ) { return response ( ) -> json ( [ 'data' => $ data , 'text' => 'Data Berhasil Disimpan' ] , 200 ) ; } else { return response ( ) -> json ( [ 'data' => $ data , 'text' => 'Data Gagal Disimpan' ] ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .
// dd($request->all());