'ditambahkan', 'updated' => 'diubah', 'deleted' => 'dihapus', 'restored' => 'dipulihkan', ]; // Aturan log: kolom fillable yang berubah saja public function getActivitylogOptions(): LogOptions { $label = property_exists($this, 'labelAktivitas') ? $this->labelAktivitas : Str::headline(class_basename($this)); $logName = property_exists($this, 'logAktivitas') ? $this->logAktivitas : Str::snake(explode('\\', static::class)[2]); return LogOptions::defaults() ->useLogName($logName) ->logFillable() ->logExcept([...self::$kolomTidakDicatat, ...$this->getHidden()]) ->dontLogIfAttributesChangedOnly(self::$kolomTidakDicatat) ->logOnlyDirty() ->dontLogEmptyChanges() ->setDescriptionForEvent(fn (string $event) => $label . ' ' . (self::$kataEvent[$event] ?? $event)); } // Tandai petani terkait public function beforeActivityLogged(Model $activity, string $event): void { if ($petaniId = $this->getAttribute('petani_id')) { $activity->properties = $activity->properties->put('petani_id', (int) $petaniId); } } }