the controller
public function storeToDatabase(Request $request)
{
$params = $request->except('_token');
$user_id = auth()->user()->id;
$product_id = $params['product_id'];
$price = $params['price'];
$quantity = $params['quantity'];
$name_product = $params['name_product'];
$total_price = $params['total_price'];
Cart::create([
'user_id' => $user_id,
'product_id' => $product_id,
'price' => $price,
'quantity' => $quantity,
'name_product' => $name_product,
'total_price' => $total_price,
]);
\Session::flash('success', 'Product ' . $name_product . ' berhasil dimasukan keranjang.');
return redirect('/carts');
}
Just eror and no console in error, idont use dd in console and then i dont know what wrong in my code
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire