DEV Community

maddrid
maddrid

Posted on

Alternative eloquent model ?

Current version of the eloquent model seems bloated with lots of unnecessary code for just querying the database .

No reusable query builder inside model ,new query class for each db interogation
vast of model code (logic ) moved into controller.
This one doesn't inspire much also : https://github.com/crocodic-studio/laravel-model
display latest posts, most viewed posts, most comented on home page
Each database interogation is a new model, new query builder, each result is a eloquent model.
Each result model has Concerns\HasAttributes,
Concerns\HasEvents,
Concerns\HasGlobalScopes,
Concerns\HasRelationships,
Concerns\HasTimestamps,
Concerns\HidesAttributes,
Concerns\GuardsAttributes,
ForwardsCalls;
to array , means looping on result , just looking for a simple model , not to bring hole script into memory for extract 20 results

Top comments (0)