/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     unset($request['_token']);
     $cartNotes = CartNote::GetCartList();
     var_dump($cartNotes);
     $Order = Order::create(['price_full' => 0, 'description' => json_encode($request->all())]);
     $sum = 0;
     foreach ($cartNotes as $key => $value) {
         $sum += $value->price * $value->count;
         $orderNote = OrderNote::create(['order_id' => $Order->id, 'product_id' => $value->prodid, 'price' => $value->price, 'count' => $value->count]);
         $orderNote->save();
         // ??
     }
     $Order->price_full = $sum;
     $Order->save();
     Session::flash('flash_message', 'Order added!');
     return redirect('/backoffice/orders');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     CartNote::destroy($id);
     Session::flash('flash_message', 'CartNote deleted!');
     return redirect('/cart');
 }
 /**
  * Add Product to Cart
  *
  * @param  int  $id product_Id
  *
  * @return Response
  */
 public function AddToCart($id)
 {
     if (Product::where('id', '=', $id)->count() != 1) {
         return redirect("catalog");
     }
     if (CartNote::where('product_id', '=', $id)->count() > 0) {
         return redirect("cart");
     }
     $cartnote = CartNote::Create(['product_id' => $id, 'count' => 1]);
     return redirect("cart");
 }