DEV Community

Discussion on: Laravel Repository Pattern

Collapse
 
mabalashov profile image
mabalashov • Edited

"To change data storage" - is not the main aim of Repository.
The main aim is to have separate layers and clean code. It becomes much easier to make scalable code, cover it by tests if you are going this way. But it makes sense to use repositories and follow the best practices of clear code if you are developing big enterprise applications.
For RAD the ActiveRecord (Eloquent) is the best

But, in the current article author suggests using Eloquent Models with Repository. It is not the best way and it will be better to use or AR or Repo. Otherwise, you will lose all the benefits of both ones.