-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Description
- Laravel Version: 5.4.24
- PHP Version: 7.0.10
- Database Driver & Version: php_sqlsrv_7_ts_x64 v4.0.8629.2
Description:
When deleting a model that has soft deletes enabled, the correct update time will be written to the database, but the model itself is not updated with the proper timestamp.
Steps To Reproduce:
I found the issue because of a very small test case that compares all attributes of a model:
// Make a test case out of it...
// Model class has created_at, updated_at and deleted_at timestamps
$model = new Model(['foo' => 'bar']);
$model->save();
sleep(2);
$model->delete();
$this->assertDatabaseHas('models', $model->getAttributes());
Result will be something like the following:
Failed asserting that a row in the table [models] matches the attributes {
"id": 1,
"foo": "bar"
"updated_at": "2017-06-08 16:31:08.000",
"created_at": "2017-06-08 16:31:08.000",
"deleted_at": "2017-06-08 16:31:10.000"
}.
Found: [
{
"id": "1",
"foo": "bar",
"created_at": "2017-06-08 16:31:08.000",
"updated_at": "2017-06-08 16:31:10.000",
"deleted_at": "2017-06-08 16:31:10.000"
}
].
Metadata
Metadata
Assignees
Labels
No labels