I'm working on a Laravel project with the MVC concept and I had some questions.
Let's say that I have a Client Management (CRUD), so I have a View (Screen with Client Data, TextBox, Combobox ...) a Controller , where I pass the screen information to the Controller and it is responsible for talking to my Model responsible for managing the object by writing to the database among other things. ..
For example, in a situation of Customer , Official and Address logo it is possible to see that 1 Client or Employee can have multiple Addresses, and this template would be
- 1 Client has multiple or none Address
- 1 Employee has multiple or none Address
Tables
Client: idc , name, cpf.
Employee: idf , name, cpf, charge.
Address: id (where Client and Employee ID enter as PK), type (To find out if you are a client or employee), zip, city, state.
Doubt 1) In the template in question would I have to create a Controller for Address or only for Client / Employee and would they already have direct contact with the Address Model? Or would I have to create a Controller for Address and the Employee / Client Controller would have to access the Address Controller and would it bridge the model?
Doubt 2) Is this template correct?
Doubt 3) Would it be better for me to create a separate address table? ie CustomerErder, CustomerErder, Customer, Employee?