Controller
• Creates model
Delegates actual operation to service
- Service is basically an attempt to handle / manipulate / format / smash together the data from the Respository Entity (model)
- Entity is the models containing methods that run SQL and return data
- Repositories use the entities to get data and contain functions to gather specific sets of data in specific formats for your app. Though the logic in them might change, the returned data should always be exactly the same
Entities: The standard models in Laravel, containing just configuration variables and methods to be used by Eloquent. Relationships, accessors and mutators belong here.
Repositories: Using Entities to get your data, they contain functions to gather specific sets of data in specific formats for your app. Though the logic in them might change, the returned data should always be exactly the same.
Services: The home of global logic, containing functions that are used throughout your app. It calls your Repositories but also validates, creates sessions and contains your logic. These all help to keep your controllers thin!
needs. Let the rest of your app work with objects/arrays returned from repos, and just handle manipulating/formatting/etc... Your repo's will grow (but split them into different files, ultimately the complexity of a project has to reside somewhere).