-2

I'm setting up a new laravel project, and want to reduce code in my controllers. Do I need to use repository pattern?”

Alpha Olomi
  • 115
  • 9

1 Answers1

1

Do I need to use repository pattern?

Trying to organise your code doesn't directly mean that you "have to" and "need to" use the repository pattern. You can safely use helper classes to extract some of the logic from the controllers. Moreover, Laravel structures its code quite well. You can help it by implementing gateways or using observers where possible. Using events is a possibility too. However, you should be aware of how these things work before implementing them since you might introduce errors with the testing later on.

Nikolay
  • 456
  • 3
  • 5