in my Laravel project i have two tables. One for products and another one for translations of products.
1 - products
2 - product_translations
So i want to write my controller for adding a product and it translations.
How can i manage it? should i write two models for my tables or is there another way with design patterns? (like if i can write an adapter to handle it)
And what is the best practice to handle the process of inserting in two tables (first, i have to insert row in products
table and then i have to insert a row in my product_translations
table.)?
Thanks in advance
2
Answers
Alright, I guess i found the answer. This package will do everything for you.
If you want to add multiple language, you can use localization.
But if you want to insert for two tables, is best to insert
product
after insert forproduct_translation
!