/**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     //		try{
     //			$productCartItem = ProductCart::findOrFail($id);
     //		} catch(ModelNotFoundException $e) {
     //			return redirect('fatalError');
     //		}
     //		$productCartItem->product_count = $request->value;
     //		$productCartItem->save();
     try {
         $productCartItem = ProductCart::findOrFail($id);
         $price = Price::with('product')->where('id', $productCartItem->price_id)->first();
         $currentAmount = $price->amount;
     } catch (ModelNotFoundException $e) {
         return redirect('fatalError');
     }
     DB::transaction(function () use($id, $price, $productCartItem, $request, &$currentAmount) {
         if ((int) $currentAmount >= (int) $request->value) {
             //				$price->amount -= (int) $request->value;
             //				$price->save();
             $productCartItem->product_count = $request->value;
             $productCartItem->save();
             $currentAmount = 0;
         }
     });
     echo $currentAmount;
 }