Laravel Collections


  • $collection = collect(['Value1', 'Value2', 'Value3']); // Keys default to 0, 1, 2, ...,


Illuminate\Support\Collection provides a fluent and convenient interface to deal with arrays of data. You may well have used these without knowing, for instance Model queries that fetch multiple records return an instance of Illuminate\Support\Collection.

For up to date documentation on Collections you can find the official documentation here