1
I’m working on an Laravel project with the concept MVC and I had some doubts.
Let’s say I have one customer management (CRUD), so I have a View (Screen with customer data, Textbox, Combobox ...) I have one Controller, where I pass the screen information to the Controller and it is responsible for chatting with my Model responsible for managing the object by recording in the database among other things ...
For example, in a Client, Functionary and Address soon it is possible to view that 1 Customer or Employee can have multiple Addresses, and this model would be
- 1 Customer has several or no Address
- 1 Employee has several or no Address
Tables
Client: idc, name, Cpf.
Official: idf, name, post, post, post.
Address: id (where the Customer and Employee Id enters as PK), type (To find out if you are customer or employee), zip code, city, state.
Doubt 1) In the model in question I would have to create a Controller for Address or only for Customer/Employee and they would already make direct contact with the Address Model? Or else I would have to create an Address Controller and the Employee/Customer Controller would have to access the Address Controller and it would bridge to the model?
Doubt 2) This model is correct?
Doubt 3) Would it be better if I create a separate address table? ie Address, Address ?