SOLID Principle By Example (S)

Single Responsibility Principle (SRP)

A class or function should have one and only one reason to change

Violates SRP

To fix above code, we can do something like this

Valid SRP

Now you have 2 classes each one has one responsibility, with Laravel you can apply “Single Action Controller” method to make sure each class has only one responsibility.