DEV Community

Discussion on: I'm a full stack web developer. Ask Me Anything!

Collapse
 
georgehanson profile image
George Hanson

Eloquent is probably one of the most powerful features of Laravel. It’s good, to an extent. I think that people certainly over use it and add business logic into models, but they should instead go into separate classes. I also don’t think that eloquent models should be used directly, instead they should be handled by repositories. The one thing I do like eloquent for is the relationships and the query scopes.

With collections, I find these useful from time to time - depending upon my use case. If I need to do some complicated operations on an array of data, filtering and sorting it is easier and clearer for any other developers to know what is happening.

I think it all comes down to personal preference and using the right tool for the use case.