DEV Community

Discussion on: Getting Started with Repository Pattern in Laravel using Inheritance and Dependency Injection

Collapse
 
thamibn_55 profile image
Thamsanca Ntuli

Where can we apply the pagination, filters and what if the relationships I want to eager load have some conditions?

Do we add new method on the interface for the above or?

Is this not recreating eloquent itself cause you have just repeated what eloquent does already ist for the sake of one day you will change from MySQL to MongoDB?

Why don't use services class if you don't wanna repeat code for example UserSevice that will have allUsers function and it will give us all users if we need it on UsersController and other controllers and so on and so on.

I feel this repository pattern is redundant and more work for no clear gains to be honest, but good article just you guys always show the simple part and don't show the reality.

Please give your thoughts on the above questions.