Until now, I told you everything about models and how to create relationships between them. I explained you how to query your data and relationships and even to specify complex conditions and constraints. However, I have never told you anything about what Eloquent's outputs are. Yes, sometimes, I mentioned an array or just the word results. Don't worry; it wasn't wrong, but there is something more under the hood.
Well, in this chapter, I will discuss collections. When retrieving your results from a query (using, for instance,
all()), you are getting a collection. That's the right term to use.
Basically, you can think of a collection as an array of results but with some extra utility methods. ...