Support the ongoing development of Laravel.io →
Installation IOC Architecture
Last updated 2 years ago.
0

Hi, I guess the idea of model repositories came from doctrine repositories? But I don't actually get what is the advantage of using it in laravel-eloquent?

Last updated 2 years ago.
0

If at a certain point of your development you decide to move from eloquent to fluent or other systems you won't need to touch your controllers and eventually the tests you've prepared for your application

luknei said:

Hi, I guess the idea of model repositories came from doctrine repositories? But I don't actually get what is the advantage of using it in laravel-eloquent?

Last updated 2 years ago.
0

Thanks for sharing, zenry!

Last updated 2 years ago.
0

luknei said:

Hi, I guess the idea of model repositories came from doctrine repositories? But I don't actually get what is the advantage of using it in laravel-eloquent?

what @spescina said but I think it's a better separation of your code. your controllers models should be as lean as possible and you repositories can be used in multiple stages of your app.

if you need to get the user's posts throughout your app you don't need to add where('user', $userid) in every controller method, you do this once in your repository and then use your repository in your controller

Last updated 2 years ago.
0

Well I get your point. I am trying to prevent builing custom query methods inside my controller to keep them as clean as possible. I am using reposinotories at work, where we use zend fw 2 + doctrine 2, since entities are quite long, there are a lot of properties and setters/getters :) Currently, I do not see the need to do this in eloquent models, because with all the necessary properties and ardent my models are up to 50 lines of code so I put my scope methods into the model class :)

Last updated 2 years ago.
0

Hi Zenry,

Not sure if this blog is what I'm looking for, but the site is down. I'm looking for an example on how to use doctrine. I'm new to both doctrine and Laravel.

thanks in advance,

Dave

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

zenry zenry Joined 3 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.