Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/activitylog.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
*/
'subject_returns_soft_deleted_models' => false,

/*
* If set to true, the causer returns soft deleted models.
*/
'causer_returns_soft_deleted_models' => false,

/*
* This model will be used to log activity.
* It should implement the Spatie\Activitylog\Contracts\Activity interface
Expand Down
5 changes: 5 additions & 0 deletions docs/installation-and-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ return [
* If set to true, the subject returns soft deleted models.
*/
'subject_returns_soft_deleted_models' => false,

/*
* If set to true, the causer returns soft deleted models.
*/
'causer_returns_soft_deleted_models' => false,

/*
* This model will be used to log activity.
Expand Down
4 changes: 4 additions & 0 deletions src/Models/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public function subject(): MorphTo
*/
public function causer(): MorphTo
{
if (config('activitylog.causer_returns_soft_deleted_models')) {
return $this->morphTo()->withTrashed();
}

return $this->morphTo();
}

Expand Down