Answer the question
In order to leave comments, you need to log in
How to properly implement the Repository pattern in Laravel?
Hello. I decided to join the beautiful and try the "Repository" pattern.
And I have some thoughts on using it, but it needs someone to say, "Yes, it is" or "No, you're making up bullshit."
As I understand it, I first create an interface, and then the repository object itself, which implements this interface.
The implementation needs methods to get, create, save models.
In the methods themselves, it will already be possible to configure the availability of the required objects using policies and so on. That is, I have one point in the application where I can access them (or not).
The question is, is it necessary to make a separate repository for each entity / model?
Can there be many different repositories for the same entity? And do they have to implement only one interface or can they be different?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question