From fded7b4ddcf2a4a6b5453440d834ba9b5f6bc77f Mon Sep 17 00:00:00 2001 From: Pierre Date: Thu, 16 Nov 2017 23:36:11 +0100 Subject: [PATCH] [5.5] `Model::$exists` to be set to false when force-deleting a model using SoftDeletes (#22100) * Model::$exists to be set to false when (force)deleting a model using SoftDeletes * Model::$exists set to false on force deletion only for soft deleteable models --- src/Illuminate/Database/Eloquent/SoftDeletes.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Illuminate/Database/Eloquent/SoftDeletes.php b/src/Illuminate/Database/Eloquent/SoftDeletes.php index ffe8f355197f..879dad278cd6 100644 --- a/src/Illuminate/Database/Eloquent/SoftDeletes.php +++ b/src/Illuminate/Database/Eloquent/SoftDeletes.php @@ -45,6 +45,8 @@ public function forceDelete() protected function performDeleteOnModel() { if ($this->forceDeleting) { + $this->exists = false; + return $this->newQueryWithoutScopes()->where($this->getKeyName(), $this->getKey())->forceDelete(); }