diff --git a/system/db/eloquent/model.php b/system/db/eloquent/model.php index 81e955be..8e8c9fb8 100644 --- a/system/db/eloquent/model.php +++ b/system/db/eloquent/model.php @@ -353,7 +353,7 @@ private function intermediate_table($model) /** * Save the model to the database. * - * @return void + * @return bool */ public function save() { @@ -376,16 +376,16 @@ public function save() // Otherwise, we will insert the model and set the ID attribute. if ($this->exists) { - $this->query->where_id($this->attributes['id'])->update($this->dirty); + $success = ($this->query->where_id($this->attributes['id'])->update($this->dirty) === 1); } else { - $this->attributes['id'] = $this->query->insert_get_id($this->attributes); + $success = is_numeric($this->attributes['id'] = $this->query->insert_get_id($this->attributes)); } - $this->exists = true; + ($this->exists = true) and $this->dirty = array(); - $this->dirty = array(); + return $success; } /**