skip to Main Content

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


  1. Chosen as BEST ANSWER

    Alright, I guess i found the answer. This package will do everything for you.


  2. 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 for product_translation!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search