re: Single Method Controllers in Laravel VIEW POST

FULL DISCUSSION
 

A really nice idea! I generally don't have to struggle with fat controllers because I put all the logic inside what I call repositories (I know technically repositories only persist data but I don't have a better term). As such, my controllers simply validate stuff and pass on the data to these repositories and pass back the success/error responses. Sometimes I think I'm doing it all wrong, while sometimes it feels like a great idea. 🧐

 

I think what you are naturally looking for is the command/handler pattern to encapsulate use cases.

 

I now think that what I'm doing is very close to the idea of services in Symfony. I read that people use services to do both input validation and business logic, which is what my "repositories" are doing. That said, thanks for the command/handler pattern. I'll make sure to look into it next!

code of conduct - report abuse