src/Carbon/Traits/Units.php
public function add($unit, $value = 1, $overflow = null)
    {
        if (is_string($unit) && func_num_args() === 1) {
            $unit = CarbonInterval::make($unit);
        }

        if ($unit instanceof DateInterval) {
            return parent::add($unit);
        }

        if (is_numeric($unit)) {
            $tempUnit = $value;
            $value = $unit;
            $unit = $tempUnit;
        }

        return $this->addUnit($unit, $value, $overflow);
    }
public function add($unit, $value = 1, $overflow = null)
    {
        if (is_string($unit) && func_num_args() === 1) {
            $unit = CarbonInterval::make($unit);
        }

        if ($unit instanceof DateInterval) {
            return parent::add($unit);
        }

        if (is_numeric($unit)) {
            $tempUnit = $value;
            $value = $unit;
            $unit = $tempUnit;
        }

        return $this->addUnit($unit, $value, $overflow);
    }
public function add ( $ unit , $ value = 1 , $ overflow = null ) { if ( is_string ( $ unit ) && func_num_args ( ) === 1 ) { $ unit = CarbonInterval :: make ( $ unit ) ; } if ( $ unit instanceof DateInterval ) { return parent :: add ( $ unit ) ; } if ( is_numeric ( $ unit ) ) { $ tempUnit = $ value ; $ value = $ unit ; $ unit = $ tempUnit ; } return $ this -> addUnit ( $ unit , $ value , $ overflow ) ; }
Add given units or interval to the current instance.

@example $date->add('hour', 3)
@example $date->add(15, 'days')
@example $date->add(CarbonInterval::days(4))

@param string|DateInterval $unit
@param int                 $value
@param bool|null           $overflow

@return CarbonInterface
Add given units or interval to the current instance .