public function update(Model $model) { $this->checkStatus(); $table = $model->getTable(); $model = (object) array_filter((array) $model); $model->update = array_filter((array) $model->update); foreach ($model as $key => $value) { if ($key !== "table" && $key !== "Adapter" && $key !== "update" && $key !== "created_at") { $values[$key . "='" . $value . "'"] = null; } } if (count($model->update) > 0) { foreach ($model->update as $key => $value) { $update[$key . "='" . $value . "'"] = $value; } } else { return false; } $query = " UPDATE `{$table}` SET " . implode(",", array_keys($update)) . " WHERE "; $query .= " " . implode(" AND ", array_keys($values)) . " "; return $this->db->query($query); }