I have a ecommerce site that has 2 types of products: books & seminars participations. They are different, and have different attributes. I am curious how would you model this in the DB and as models (since you cannot inherit multiple classes)
Right now i have something like: DB
products (id, name ....)
seminars (id, title, date ....)
cart (id, session_id ...)
cart (id, cart_id, type, id_model) the type is product OR seminar
modeller için i have a
cart_item_abstract
cart_item_product -> cart_item_abstract
cart_item_seminar -> cart_item_abstract
cart_order_product -> cart_item_product
cart_order_seminar -> cart_item_seminar
Ama bu i sipariş nesneler tarafından gerekli bazı kod çoğaltmak zorunda kalıyoruz.