Open cbj4074 opened 4 years ago
After discussing it with other contributors, we should not do what we did in the second link because that implementation calls methods on concrete classes, which results in tight coupling.
Instead, we should always use the related models' repositories.
Rather than modify related models "manually" within the repository methods, like this
https://github.com/indiehd/velkart/blob/7dd235003eecc2ffe05d74c56e3b110e4f1ddf6c/src/Repositories/Eloquent/ProductRepository.php#L56-L58
would it be better to use an Observer pattern with an event-driven approach, more like we do here?
https://github.com/indiehd/web-api/blob/26598927babfa285e013bdf59d0c1628fd98df6f/app/Observers/AlbumObserver.php#L38-L49