public static function of($builder)
    {
        if ($builder instanceof \Illuminate\Database\Eloquent\Builder) {
            $builder = $builder->getQuery();
        }

        $collection = new Collection($builder);
        $collection = self::_addCustomAttributes($collection);
        self::$_lastCollection = $collection;
        return self::collection();
    }
public static function of($builder)
    {
        if ($builder instanceof \Illuminate\Database\Eloquent\Builder) {
            $builder = $builder->getQuery();
        }

        $collection = new Collection($builder);
        $collection = self::_addCustomAttributes($collection);
        self::$_lastCollection = $collection;
        return self::collection();
    }
public static function of ( $ builder ) { if ( $ builder instanceof \ Illuminate \ Database \ Eloquent \ Builder ) { $ builder = $ builder -> getQuery ( ) ; } $ collection = new Collection ( $ builder ) ; $ collection = self :: _addCustomAttributes ( $ collection ) ; self :: $ _lastCollection = $ collection ; return self :: collection ( ) ; }
Sets builder and returns collection

@param \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder $builder
@return Collection
Sets builder and returns collection