spatie / laravel-activitylog

Log activity inside your Laravel app
https://docs.spatie.be/laravel-activitylog
MIT License
5.3k stars 712 forks source link

Allow `shouldLogUnguarded()` to respect `Model::unguard()` #1187

Closed newtonjob closed 1 year ago

newtonjob commented 1 year ago

When Model::unguard() is used in Laravel projects, it is expected that the developer intends to unguard ALL Models without necessary setting $guarded = [] across all models.

This PR allows the shouldLogUnguarded method on the LogsActivity trait to respect Model::unguard();

shouldLogUnguarded is expected to return true whenever Model::unguard() has been invoked, of course, unless logUguarded has been explicitly set to false on the model's LogOptions.

newtonjob commented 1 year ago

@freekmurze I'd really appreciate it if you could spare a moment to have a look at this PR. It's indeed a serious pain point.