mercredi 13 septembre 2023

In this code i can't run operation to insert database in laravel , may anyone askme where is wrong in my code

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



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/0T6etgj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire