'integer', ]; } public function user(): BelongsTo { return $this->belongsTo(User::class); } public function getActivitylogOptions(): LogOptions { return LogOptions::defaults() ->logOnly(['full_name', 'phone', 'address', 'base_salary']) ->logOnlyDirty() ->useLogName('Profil Pegawai'); } public function tapActivity(Activity $activity, string $eventName) { $activity->description = match ($eventName) { 'created' => 'TAMBAH', 'updated' => 'UBAH', 'deleted' => 'HAPUS', default => $activity->description, }; if (isset($activity->properties['attributes'])) { $attributeMap = [ 'full_name' => 'Nama Lengkap', 'phone' => 'No. Telepon', 'address' => 'Alamat', 'base_salary' => 'Gaji Pokok', ]; $properties = $activity->properties->toArray(); $localizeValues = function ($attrs) use ($attributeMap) { $newAttrs = []; foreach ($attrs as $key => $value) { $label = $attributeMap[$key] ?? $key; $newAttrs[$label] = $value; } return $newAttrs; }; $properties['attributes'] = $localizeValues($properties['attributes']); if (isset($properties['old'])) { $properties['old'] = $localizeValues($properties['old']); } $activity->properties = collect($properties); } } }