laravel/laravel — Issue #324: Timestamps should use $this->attributes instead of plain $this->updated_at
Author: lomboo
Created: 2012-02-09 12:53:44+00:00
State: open

The timestamp method

```
protected function timestamp()
{
$this->updated_at = date('Y-m-d H:i:s');

if ( ! $this->exists) $this->created_at = $this->updated_at;
}
```

Should be

```
protected function timestamp()
{
$this->updated_at = date('Y-m-d H:i:s');

if ( ! $this->exists) $this->created_at = $this->attributes['updated_at'];
}
```

In case someone overrides the __get method.

e.g. I return a DateTime object when I do $model->updated_at, so the $model->save() operation will fail because timestamp assigns a DateTime to created_at instead of a plain string.