oop - Models getting out of hand -
we use laravel in our company , follow 2 simple conventions:
- controllers should thin.
- models represents database entities (user, roles, cars)
now we're facing dilemma: have screen complicated data graphs represented require long , heavy logic produce. should put of logic? controllers should thin - not in controllers. models represent data entities, can't model since screen displays data of other models don't have actual table/database entity. services doesn't sound normal place.
i wondering how did approach similar situations
i put logic service. in service can run other services (in case logic in other service or if service complicated) , use repositories (or models in case don't use repositories). of course there no point put big code or logic controllers because run services return desired output.
Comments
Post a Comment