Browse Source

Merge pull request #902 from JesseObrien/feature/eloquent-update-timestamp

Feature/eloquent update timestamp
Taylor Otwell 12 years ago
parent
commit
a9d27ba79c
1 changed files with 4 additions and 2 deletions
  1. 4 2
      laravel/database/eloquent/model.php

+ 4 - 2
laravel/database/eloquent/model.php

@@ -218,9 +218,11 @@ abstract class Model {
 	{
 		$model = new static(array(), true);
 
-		if (static::$timestamps) $attributes['updated_at'] = new \DateTime;
+		$model->fill($attributes);
 
-		return $model->query()->where($model->key(), '=', $id)->update($attributes);
+		if (static::$timestamps) $model->timestamp();
+
+		return $model->query()->where($model->key(), '=', $id)->update($model->attributes);
 	}
 
 	/**