If "garbage collection" is to be applied to Carts, a foreign key from the Order would prevent Cart deletion.
The more I think about this, the more I can't see any value in this relationship. If the intention is, in effect, to "copy" the items from a Cart instance into the OrderProduct pivot table during checkout (i.e., at the instant at which payment is processed successfully), then the Cart has no further value, and hence, this relationship is unnecessary.
If "garbage collection" is to be applied to
Carts
, a foreign key from theOrder
would preventCart
deletion.The more I think about this, the more I can't see any value in this relationship. If the intention is, in effect, to "copy" the items from a
Cart
instance into theOrderProduct
pivot table during checkout (i.e., at the instant at which payment is processed successfully), then theCart
has no further value, and hence, this relationship is unnecessary.