Collections

    The class provides a fluent, convenient wrapper for working with arrays of data. For example, check out the following code. We'll use the collect helper to create a new collection instance from the array:

    Basic Usage

    Creating Collections

    1. $collection = collect([1, 2, 3]);

    Of course, collections of Eloquent objects are always returned as instances; however, you should feel free to use the Collection class wherever it is convenient for your application.

    Explore The Collection