public function clear() { $product = new Product(); $cart = Session::get("cart"); foreach ($cart as $id => $quantity) { $product->restIncrement($id, $quantity); } Session::forget("cart"); }
public function changeStatus(Request $request, Order $order, Product $product, $id) { $input = $request->order_status; if ($input == 4) { $content = $order->find($id)->content; foreach ($content as $item) { $product->restIncrement($item->product_id, $item->quantity); } } $order->changeStatus($id, $input); $status = $order->find($id)->status->title; return redirect()->back()->with('message', "Статус заказа изменен на '{$status}'"); }