public function cartItemIncrement($rowid)
 {
     $item = Cart::instance(auth()->user()->id)->get($rowid);
     if (!$item) {
         abort(404);
     }
     Cart::update($rowid, $item->qty + 1);
     return redirect()->back();
 }
 public function updateCartAjax(Request $request)
 {
     $dish_id = $request->input('dish_id');
     $number = $request->input('number');
     $rowids = Cart::search(array('id' => $dish_id));
     foreach ($rowids as $key => $value) {
         Cart::update($value, array('qty' => $number));
     }
     return Response::json(array('success' => TRUE));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param   string      $rowid      Item identifier in the cart
  * @param   integer     $quantity   New quantity of the item|Array of attributes to update
  * @return  Response
  */
 public function update($rowid, $quantity)
 {
     $quantity = intval($quantity);
     try {
         Cart::update($rowid, $quantity);
     } catch (\Exception $e) {
         // If the items does not exist, we do nothing
     }
     return redirect()->route('cart.index');
 }
Beispiel #4
0
 public function changeQuantityItem(ChangeQtyItemRequest $request)
 {
     $dataRequest = $request->all();
     //check exist
     if (is_object(Cart::get(Input::get('idrow')))) {
         if (Cd::find($dataRequest['id'])->quantity - $dataRequest['qty'] >= 0) {
             Cart::update($dataRequest['idrow'], ['qty' => $dataRequest['qty']]);
             return redirect()->back()->with('success', 'Updated item!');
         } else {
             return redirect_errors("Sorry we aren't Cd for You");
         }
     } else {
         return redirect_errors('You haven"t this Item!');
     }
 }
 public function postUpdate()
 {
     $rowId = Input::get('rowid');
     $qty = Input::get('qty-n');
     Cart::update($rowId, $qty);
     return redirect('store/cart');
 }
 public function update($rowId, $quantity)
 {
     return Cart::update($rowId, $quantity);
 }
 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(Request $request)
 {
     Cart::update($request->input('id'), $request->input('amount'));
     return redirect()->back();
 }