How develop Model and validation |
(01-13-2020, 11:49 AM)jreklund Wrote: This depends on the person codeing it. If you are doing all validation in the Controller, you you need to duplicate it in every Controller. If you are doing it in the Model, you only need to do it ones.I agree with you But in model,what to return to controller? Example: if (!'/\d+/',$mobile) return 'invalid'; or return -1; What one is correct? Thanks (01-13-2020, 08:33 AM)asrofie Wrote: I think bettet create service class for handling logic process. You can use multiple model (example save log history), and also if you want to create REST Api login, you just call this service class. You can prevent duplicating code for login. Read ADR pattern. Do you mean Hook? (01-13-2020, 11:49 AM)jreklund Wrote: This depends on the person codeing it. If you are doing all validation in the Controller, you you need to duplicate it in every Controller. If you are doing it in the Model, you only need to do it ones. I see relate link It is good way thanks |
Welcome Guest, Not a member yet? Register Sign In |