public function log(string $description)
{
$activity = new Activity();
if ($this->performedOn) {
$activity->subject()->associate($this->performedOn);
}
if ($this->causedBy) {
$activity->causer()->associate($this->causedBy);
}
$activity->properties = $this->properties;
$activity->description = $this->replacePlaceholders($description, $activity);
$activity->log_name = $this->logName;
$activity->save();
}