Laravel Collections

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Syntax

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

Remarks

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



Got any Laravel Question?