I have a call to getActivitylogOptions()
in a model.
But I need the data saved in the log to be different in the case of insert/update/delete.
For example, when inserting a new line, I only want to save one or two info fields. But in case of an update, I need to save all the fields that have been modified to know what exactly the user modified.
If I leave it like the following code, the update is correct, but when inserting, it saves all the fields which I don't need.
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()
->logAll()
->logOnlyDirty();
}
Is there any way to change the log according to the action?
Hay, This is how i have it set and is only logging changes to properties that have been updated