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

What do you mean by Repositories instead of Models ?

class UserRepository{

  public function getPopularWomen(){

    return User::popular()->women()->orderBy('created_at')->get();

  }

}

:)

That could be useful for testing (by injecting repositories in the controllers). But repositories are often associated with the data mapper design pattern, which has a different way of handling data than active record (Eloquent's design pattern). Take a look at Doctrine if you're interested in the data mapper pattern.

Last updated 2 years ago.
0

It's not difficult. I just do something like this: https://gist.github.com/thepsion5/eb0af8b3040eaa0b219e

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jhauraw jhauraw Joined 12 May 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.