public function sum($attr)
    {
        $builder = $this->_makeBuilderForAggregations(" sum($attr) ");
        return $this->_executeAndReturnFirst($builder, $this->_vals);
    }
public function sum($attr)
    {
        $builder = $this->_makeBuilderForAggregations(" sum($attr) ");
        return $this->_executeAndReturnFirst($builder, $this->_vals);
    }
public function sum ( $ attr ) { $ builder = $ this -> _makeBuilderForAggregations ( " sum($attr) " ) ; return $ this -> _executeAndReturnFirst ( $ builder , $ this -> _vals ) ; }
Return collection attribute sum

Example:
echo Person::all()->sum("age");

@param string $attr attribute

@return mixed sum
Return collection attribute sum