logUnguarded() does not respect Model::unguard()
colinmackinlay opened this issue · comments
Describe the bug
logUnguarded()
works provided that $guarded
is set explicitly in the model. If it is not set explicitly but globally set, say in AppServiceProvider
using Model::unguard();
then nothing is logged.
To Reproduce
- remove
$fillable
and$guarded
from a model that use usesLogsActivity
- call
Model::unguard();
inAppServiceProvider
in theboot
method - set
public function getActivitylogOptions() : LogOptions
{
return LogOptions::defaults()->logUnguarded();
}
- Make some changes to a model and save them
Expected behavior
Some changed properties should be logged but none are
Versions (please complete the following information)
- PHP: 8.1
- Database: MySql
- Laravel: 9.38
- Package: larvel-activitylog
@colinmackinlay Can you try the fix from #1157 and confirm if it works.