diff --git a/src/Collection/BaseCollectionTrait.php b/src/Collection/BaseCollectionTrait.php index 1cb1ad2..1316700 100644 --- a/src/Collection/BaseCollectionTrait.php +++ b/src/Collection/BaseCollectionTrait.php @@ -29,6 +29,21 @@ public function __construct(array $data = []) $this->data = $data; } + /** + * Create a new instance of the collection from the given data. + * + * This method acts as a wrapper around the `make` method, + * allowing for the creation of a collection instance using + * the provided data. The data is processed to ensure it is + * in an array format suitable for the collection. + * + * @param mixed $data The data to initialize the collection with. + * @return static A new instance of the collection. + */ + public static function from(mixed $data): static + { + return static::make($data); + } /** * Create a new instance of the collection with the given data. @@ -46,7 +61,6 @@ public static function make(mixed $data): static return $instance; } - /** * Dynamically handle calls to methods on the collection. *