3 months ago

Where to put controller logic if it is sufficiently complex?

Posted 3 months ago by catinodev

In a number of my projects the methods of my controllers are a mess: huge number of lines of code in some of them. I have read around the web that this is not a good practice and some pattern should be adopted to keep the controllers neat, as well as reduce code duplication. I have heard of a 'service layer' before, as well as using events in a similar manner -- but I'm not quite sure I understand the general workflow of integrating either of these options yet.

Is there a standard that most Laravel developers adopt for achieving this goal?

What does integrating a service layer look like in a Laravel application?

Please sign in or create an account to participate in this conversation.