Skip to content

Latest commit

 

History

History
14 lines (14 loc) · 395 Bytes

collections-recursive.md

File metadata and controls

14 lines (14 loc) · 395 Bytes
Collection::macro('recursive', function(){
    return $this->map(function ($value) {
        if (is_array($value) || is_object($value)) {
            $collection = Collection::make($value);
            if(method_exists($collection, 'recursive')){
                return $collection->recursive();
            }
            return $collection;
        }
        return $value;
    });
});