app/Http/Controllers/ProductController.php
/**
     * Update the specified resource in storage.
     *
     * @param \Illuminate\Http\Request $request
     * @param \App\Product $product
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Product $product)
    {
        $request->validate([
            'qty' => 'required|numeric'
        ]);
        $cart = new Cart(session()->get('cart'));
        $cart->updateQty($product->id, $request->qty);
        session()->put('cart', $cart);
        return redirect()->route('cart.show')->with('success', 'product was updated');
    }
public function update ( Request $ request , Product $ product ) { $ request -> validate ( [ 'qty' => 'required|numeric' ] ) ; $ cart = new Cart ( session ( ) -> get ( 'cart' ) ) ; $ cart -> updateQty ( $ product -> id , $ request -> qty ) ; session ( ) -> put ( 'cart' , $ cart ) ; return redirect ( ) -> route ( 'cart.show' ) -> with ( 'success' , 'product was updated' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .