0

How to add a custom description in spatie laravel-activitlog. I have read the documentation there they mentioned two ways

first way

activity()
   ->performedOn($someContentModel)
   ->log('Custome Description');

the first way only creates a log with a custom description. enter image description here

the second way is by customizing the description in the model. Second method

    public function getActivitylogOptions()
    {
        return LogOptions::defaults()
        ->setDescriptionForEvent(fn(string $eventName) => "This model has been {$eventName}");
    }

But I want to add a custom description in the controller while adding, deleting or updating a Model.

Mohammad Edris Raufi
  • 1,393
  • 1
  • 13
  • 34

0 Answers0