logUnguarded() does not respect Model::unguard() #1123
Open
Description
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