public function store(Request $request) { $token = $request->get('_token'); $quant = $request->get('quantity'); $product_id = $request->get('product_id'); $price = Product::find($product_id)->price; $cart = Cart::create(['product_id' => $product_id, 'token' => $token, 'price' => $price, 'quantity' => $quant]); $cart_id = $cart->id; Command_unf::create(['product_id' => $product_id, 'cart_id' => $cart_id, 'token' => $token, 'price' => $price, 'quantity' => $quant]); return redirect('/')->with(['cart-store' => 'Le produit a été ajouté à votre panier !', 'alert' => 'success']); }
public function command_unfHistoric() { $command_unfs = Command_unf::all(); return view('admin.command_unf', compact('command_unfs')); }