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

I think you should start with Repository pattern:

Blog post 1

blog post 2

these are the first results from google.

If you would be kind enough to buy Jeffry Way a lunch, try Laracast.

Last updated 2 years ago.
0

So in basic terms, repositories can act almost like include files (in addition to serving other purposes).

Is that accurate?

Last updated 2 years ago.
0

jerauf said:

So in basic terms, repositories can act almost like include files (in addition to serving other purposes).

Is that accurate?

Nope. Repository pattern is designed to solve exact problem and should be used to:

The repository mediates between the data source layer and the business layers of the application. It queries the data source for the data, maps the data from the data source to a business entity, and persists changes in the business entity to the data source. A repository separates the business logic from the interactions with the underlying data source or Web service.

There are other good practice for repeated code but it all depends on that code purpose.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jerauf jerauf Joined 16 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.