diff --git a/src/Illuminate/Database/Eloquent/SoftDeletes.php b/src/Illuminate/Database/Eloquent/SoftDeletes.php index ab81a4d43760..d8b736306813 100644 --- a/src/Illuminate/Database/Eloquent/SoftDeletes.php +++ b/src/Illuminate/Database/Eloquent/SoftDeletes.php @@ -76,9 +76,7 @@ protected function runSoftDelete() $columns[$this->getUpdatedAtColumn()] = $this->fromDateTime($time); } - if ($query->update($columns)) { - $this->syncOriginal(); - } + $query->update($columns); } /** diff --git a/tests/Database/DatabaseEloquentSoftDeletesIntegrationTest.php b/tests/Database/DatabaseEloquentSoftDeletesIntegrationTest.php index a4aab9adb13d..6b52eb290e8d 100644 --- a/tests/Database/DatabaseEloquentSoftDeletesIntegrationTest.php +++ b/tests/Database/DatabaseEloquentSoftDeletesIntegrationTest.php @@ -268,6 +268,7 @@ public function testUpdateModelAfterSoftDeleting() /** @var SoftDeletesTestUser $userModel */ $userModel = SoftDeletesTestUser::find(2); $userModel->delete(); + $userModel->syncOriginal(); $this->assertEquals($now->toDateTimeString(), $userModel->getOriginal('deleted_at')); $this->assertNull(SoftDeletesTestUser::find(2)); $this->assertEquals($userModel, SoftDeletesTestUser::withTrashed()->find(2)); @@ -283,6 +284,7 @@ public function testRestoreAfterSoftDelete() /** @var SoftDeletesTestUser $userModel */ $userModel = SoftDeletesTestUser::find(2); $userModel->delete(); + $userModel->syncOriginal(); $userModel->restore(); $this->assertEquals($userModel->id, SoftDeletesTestUser::find(2)->id); @@ -301,6 +303,7 @@ public function testSoftDeleteAfterRestoring() $this->assertEquals($userModel->deleted_at, SoftDeletesTestUser::find(1)->deleted_at); $this->assertEquals($userModel->getOriginal('deleted_at'), SoftDeletesTestUser::find(1)->deleted_at); $userModel->delete(); + $userModel->syncOriginal(); $this->assertNull(SoftDeletesTestUser::find(1)); $this->assertEquals($userModel->deleted_at, SoftDeletesTestUser::withTrashed()->find(1)->deleted_at); $this->assertEquals($userModel->getOriginal('deleted_at'), SoftDeletesTestUser::withTrashed()->find(1)->deleted_at);