re: Laravel Repository Pattern VIEW POST


"Our application will work the same way as before even if the data engine has changed and we didn’t change even 1 line of code in our controller or anywhere else!"

I don't use Laravel much at the moment, but won't this still depend on how your views are using whatever was returned by your repository? From what I can tell, your sample is returning a collection of eloquent models using the all method. What happens if your view file starts referencing eloquent-only methods and/or relationships? Won't switching repositories break this, unless you add another layer of abstraction to what your repository returns?

code of conduct - report abuse