diff --git a/src/Models/Activity.php b/src/Models/Activity.php index abde1b6d..043fca72 100644 --- a/src/Models/Activity.php +++ b/src/Models/Activity.php @@ -62,7 +62,11 @@ public function __construct(array $attributes = []) public function subject(): MorphTo { if (config('activitylog.subject_returns_soft_deleted_models')) { - return $this->morphTo()->withTrashed(); + return $this->morphTo()->constrain([function ($query) { + return $query->when($query->hasMacro('withTrashed'), function ($query) { + $query->withTrashed(); + }); + }]); } return $this->morphTo();