0

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?

Karl Hill
  • 12,937
  • 5
  • 58
  • 95
Phyron
  • 613
  • 1
  • 9
  • 25

0 Answers0