app/Http/Controllers/APIProductController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request)
    {
        $product = Product::where('id', $request->id)->first();
        $product->name = $request->name;
        $product->category = $request->category;
        $product->description = $request->description;
        $product->quantity = $request->quantity;
        $product->price = $request->price;
        $product->save();
        return response()->json(['data' => $product], 201);
    }
public function update ( Request $ request ) { $ product = Product :: where ( 'id' , $ request -> id ) -> first ( ) ; $ product -> name = $ request -> name ; $ product -> category = $ request -> category ; $ product -> description = $ request -> description ; $ product -> quantity = $ request -> quantity ; $ product -> price = $ request -> price ; $ product -> save ( ) ; return response ( ) -> json ( [ 'data' => $ product ] , 201 ) ; }
Update the specified resource in storage.
Update the specified resource in storage .