For some reason when restoring the cart from the database, the last item's associative model is set to NULL.
For all other items the associative model is fine, only the last item in the cart array loses its connection to the associative model.
Anyone else experiencing this issue?
-
It seems, when a cart is stored, the last CartItem does not keep the CartItemassociatedModel value.
Example
I have 6 products in the cart. (cart is stored in DB)
The last CartItem's associated model value is NULL. (it should be '\App\Models\Product' like the rest)
When I add another Item to the cart.
I erase the currently stored cart, ( Cart::erase($identifier) )
And store the new cart with 7 items ( Cart::store($identifier) )
The 6th item, that just had NULL on its associated model, now does have the expected value.
But the item just added (7th) has NULL for its associated model.
For some reason when restoring the cart from the database, the last item's associative model is set to NULL. For all other items the associative model is fine, only the last item in the cart array loses its connection to the associative model.
Anyone else experiencing this issue?
-
It seems, when a cart is stored, the last CartItem does not keep the CartItemassociatedModel value.
Example I have 6 products in the cart. (cart is stored in DB) The last CartItem's associated model value is NULL. (it should be '\App\Models\Product' like the rest)
When I add another Item to the cart. I erase the currently stored cart, ( Cart::erase($identifier) ) And store the new cart with 7 items ( Cart::store($identifier) )
The 6th item, that just had NULL on its associated model, now does have the expected value. But the item just added (7th) has NULL for its associated model.