Published 10 months ago by PaulDiamant
I'm working on an ecommerce platform, and have a products table, orders table and orders_products table. Should I save the price of the single item in the orders_products table or fetch it every time the user goes to their cart and after they make a purchase?
Imo @Dry7 is right, the correct table for the price of a product is the crosstable between orders and products because it reflects the state of the information at the time the order is made.
Another thing: in Laravel crosstables are usually named by the singular names of the related tables in alphabetical order. In your specific case the laravel-esque name of your crosstable would be order_product.