My Laravel Repository Pattern Solution (in only 30 lines of code)

Written by sjors-van-dongen | Published 2019/09/16
Tech Story Tags: laravel | web-development | design-patterns | php | eloquent | laravel-repository-pattern | laravel-repository | programming

TLDR A 30 line script can finally provide a good solution for a repository pattern in Laravel apps. The problem is that you can’t use Eloquent functions on your repositories. A repository with the use of the Repository trait would look like this: $model-repositories-repository-referreditories. The solution was created by creating a simple piece of code which enables all the features of Elquent on your repository. This way you can use the repository pattern as a way to keep your models and your repositories clean!via the TL;DR App

no story

Published by HackerNoon on 2019/09/16