Crinsane/LaravelShoppingcart – Model not associating correctly or empty

I was having the exact same issue, using the most recent version 2.3.0.

Cart::add($product->uid, $product->name, $qty, $product->price)->associate('App\Models\Product');

In a foreach in my view, dd($product->model) returns null.

When try $this->cart->add($product->id, $product->title, 1, $product->price)->associate(‘App\Models\Product’);

works perfectly, primary key of product table has to placed in id. In my case I have id as primary key and uid as unique in product table.