Laravel Collections Creating Collections


Using the collect() helper, you can easily create new collection instances by passing in an array such as:

$fruits = collect(['oranges', 'peaches', 'pears']);

If you don't want to use helper functions, you can create a new Collection using the class directly:

$fruits = new Illuminate\Support\Collection(['oranges', 'peaches', 'pears']);

As mentioned in the remarks, Models by default return a Collection instance, however you are free to create your own collections as needed. If no array is specified on creation, an empty Collection will be created.