lundi 4 janvier 2016

Logic of repository pattern laravel

I am learning to use the Laravel framework.

I came across the repositories, said in several sites be a good practice of development.

I found some packages that help implement this practice in Laravel, but missed some features, but I think I'm failing to understand very well the logic and its benefits.

Considering studying that part, I created a package that shows how to think is this implementation, but I still have many questions.

http://ift.tt/1kF1XA0

Ex:

Scopes and relations should be transferred to the repository or kept in the model?

How to implement the type functions "increment(), decrement()" in the repository? or is it correct to call them on the controller?

$model = $repository->find($id);
$model->increment();

Thank you

Aucun commentaire:

Enregistrer un commentaire