public function update($data = null)
    {
        $fields = $this->getFields();
        $sql1 = '';
        $args = array();
        foreach ($fields as $field) {
            if (in_array($field, $this->updated_at_fileds)) {
                $this->{$field} = now();
            }
            $value = $this->getFieldValue($field, $data);
            if (isset($value) && !$this->isIndex($field)) {
                $args[] = $value;
                $sql1 .= "`$field` = ?, ";
            }
        }
        if (!empty($sql1)) {
            $sql1 = substr($sql1, 0, -2);
            $index = $this->getIndex();
            $indexValue = $this->db->escape_string($this->getFieldValue($index, $data));
            if (!$indexValue) {
                return false;
            }
            $args[] = $indexValue;
            return $this->db->exec("UPDATE `{$this->table_name}` SET $sql1 WHERE `$index` = ?", $args, $this->getCacheId($indexValue));
        }
        return false;
    }
public function update($data = null)
    {
        $fields = $this->getFields();
        $sql1 = '';
        $args = array();
        foreach ($fields as $field) {
            if (in_array($field, $this->updated_at_fileds)) {
                $this->{$field} = now();
            }
            $value = $this->getFieldValue($field, $data);
            if (isset($value) && !$this->isIndex($field)) {
                $args[] = $value;
                $sql1 .= "`$field` = ?, ";
            }
        }
        if (!empty($sql1)) {
            $sql1 = substr($sql1, 0, -2);
            $index = $this->getIndex();
            $indexValue = $this->db->escape_string($this->getFieldValue($index, $data));
            if (!$indexValue) {
                return false;
            }
            $args[] = $indexValue;
            return $this->db->exec("UPDATE `{$this->table_name}` SET $sql1 WHERE `$index` = ?", $args, $this->getCacheId($indexValue));
        }
        return false;
    }
public function update ( $ data = null ) { $ fields = $ this -> getFields ( ) ; $ sql1 = '' ; $ args = array ( ) ; foreach ( $ fields as $ field ) { if ( in_array ( $ field , $ this -> updated_at_fileds ) ) { $ this -> { $ field } = now ( ) ; } $ value = $ this -> getFieldValue ( $ field , $ data ) ; if ( isset ( $ value ) && ! $ this -> isIndex ( $ field ) ) { $ args [ ] = $ value ; $ sql1 .= "`$field` = ?, " ; } } if ( ! empty ( $ sql1 ) ) { $ sql1 = substr ( $ sql1 , 0 , - 2 ) ; $ index = $ this -> getIndex ( ) ; $ indexValue = $ this -> db -> escape_string ( $ this -> getFieldValue ( $ index , $ data ) ) ; if ( ! $ indexValue ) { return false ; } $ args [ ] = $ indexValue ; return $ this -> db -> exec ( "UPDATE `{$this->table_name}` SET $sql1 WHERE `$index` = ?" , $ args , $ this -> getCacheId ( $ indexValue ) ) ; } return false ; }
Si el modelo tiene indice actualiza el modelo con los datos

@param null $data
@return bool
@throws \Exception
Si el modelo tiene indice actualiza el modelo con los datos