Laravel - Collections - Method Wrap

The static wrap method wraps the given value in a collection when applicable:

    
    use Illuminate\Support\Collection;
    
    $collection = Collection::wrap('John Doe');
    
    $collection->all();
    
    // ['John Doe']
    
    $collection = Collection::wrap(['John Doe']);
    
    $collection->all();
    
    // ['John Doe']
    
    $collection = Collection::wrap(collect('John Doe'));
    
    $collection->all();
    
    // ['John Doe']