diff --git a/src/Traits/Actions/Comment/isCommentable.php b/src/Traits/Actions/Comment/isCommentable.php index 92fc6ee..fc45b09 100644 --- a/src/Traits/Actions/Comment/isCommentable.php +++ b/src/Traits/Actions/Comment/isCommentable.php @@ -15,7 +15,11 @@ trait isCommentable public static function bootIsCommentable() { static::deleting(function ($model) { - $model->comments()->delete(); + if (in_array(SoftDeletes::class, class_uses($model))) { + $model->comments()->delete(); + } else { + $model->comments()->forceDelete(); + } }); } diff --git a/src/Traits/Actions/Comment/isCommenter.php b/src/Traits/Actions/Comment/isCommenter.php index b94102c..3f7ba76 100644 --- a/src/Traits/Actions/Comment/isCommenter.php +++ b/src/Traits/Actions/Comment/isCommenter.php @@ -15,7 +15,11 @@ trait isCommenter public static function bootIsCommenter() { static::deleting(function ($model) { - $model->comments()->delete(); + if (in_array(SoftDeletes::class, class_uses($model))) { + $model->comments()->delete(); + } else { + $model->comments()->forceDelete(); + } }); }