DEV Community

Zeenathul nizreen
Zeenathul nizreen

Posted on

1

I got this error when i am add an item to cart in laravel: Darryldecode\Cart\Exceptions\InvalidItemException validation.required

In my E-commerce website, I added darryldecode/laravelshoppingcart to add cart.

This is my CartController.php

<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Product;
use App\Category;

class CartController extends Controller
{
    
    public function index()
    {
        $cartItems = \Cart::session(auth()->id())->getContent();
        
         return view ('cart',compact(cartItems));
         
     }
    
     public function create()
    {
        //
    }

    public function store(Request $request)
    {

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay