src/InsertOnDuplicateKey.php
public static function replace(array $data)
    {
        if (empty($data)) {
            return false;
        }

        // Case where $data is not an array of arrays.
        if (!isset($data[0])) {
            $data = [$data];
        }

        $sql = static::buildReplaceSql($data);

        $data = static::inLineArray($data);

        return self::getModelConnectionName()->affectingStatement($sql, $data);
    }
public static function replace(array $data)
    {
        if (empty($data)) {
            return false;
        }

        // Case where $data is not an array of arrays.
        if (!isset($data[0])) {
            $data = [$data];
        }

        $sql = static::buildReplaceSql($data);

        $data = static::inLineArray($data);

        return self::getModelConnectionName()->affectingStatement($sql, $data);
    }
public static function replace ( array $ data ) { if ( empty ( $ data ) ) { return false ; } // Case where $data is not an array of arrays. if ( ! isset ( $ data [ 0 ] ) ) { $ data = [ $ data ] ; } $ sql = static :: buildReplaceSql ( $ data ) ; $ data = static :: inLineArray ( $ data ) ; return self :: getModelConnectionName ( ) -> affectingStatement ( $ sql , $ data ) ; }
Insert using mysql REPLACE INTO.

@param array $data

@return int 1 if row is inserted without replacements, greater than 1 if rows were replaced
Insert using mysql REPLACE INTO .