addMediaCollection('logo') ->singleFile(); $this->addMediaCollection('icon') ->singleFile(); } protected function logoUrl(): Attribute { return Attribute::make( get: fn () => $this->getFirstMediaUrl('logo') ?: null, ); } protected function iconUrl(): Attribute { return Attribute::make( get: fn () => $this->getFirstMediaUrl('icon') ?: null, ); } public function getActivitylogOptions(): LogOptions { return LogOptions::defaults() ->logOnly(['name', 'description', 'address', 'phone']) ->logOnlyDirty() ->useLogName('Pengaturan Umum'); } 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 = [ 'name' => 'Nama Aplikasi', 'description' => 'Deskripsi', 'address' => 'Alamat', 'phone' => 'No. Telepon', ]; $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); } } }