-
-
Notifications
You must be signed in to change notification settings - Fork 742
Open
Labels
documentationgood first issuehacktoberfesthttps://hacktoberfest.digitalocean.comhttps://hacktoberfest.digitalocean.comhelp wanted
Description
We are logging activity of several models, some using SoftDeletes trait and others not.
When we set config option 'subject_returns_soft_deleted_models' => true then calling subject() on any model not using SoftDeletes trait throws an exception: Call to undefined method Illuminate\Database\Eloquent\Builder::withTrashed().
Can the subject() method below be made to check first whether the Model uses the SoftDeletes trait? Or perhaps check whether withTrashed() is a defined method on the Model? I tried a few things but couldn't figure out how to get the class of the Model..
laravel-activitylog/src/Models/Activity.php
Lines 28 to 35 in 68eb6e6
| public function subject(): MorphTo | |
| { | |
| if (config('activitylog.subject_returns_soft_deleted_models')) { | |
| return $this->morphTo()->withTrashed(); | |
| } | |
| return $this->morphTo(); | |
| } |
Metadata
Metadata
Assignees
Labels
documentationgood first issuehacktoberfesthttps://hacktoberfest.digitalocean.comhttps://hacktoberfest.digitalocean.comhelp wanted