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

Feature/eloquent update timestamp
This commit is contained in:
Taylor Otwell 2012-07-06 17:07:34 -07:00
commit a9d27ba79c
1 changed files with 4 additions and 2 deletions

View File

@ -218,9 +218,11 @@ public static function update($id, $attributes)
{
$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);
}
/**