belongsTo(User::class, 'author_id', 'id'); } public function getActivitylogOptions(): LogOptions { return LogOptions::defaults() ->logOnly(['title', 'slug', 'content', 'image', 'link', 'category', 'author_id']) // kolom yang dicatat ->useLogName('news') // nama log ->logOnlyDirty(); // hanya log kalau ada perubahan } public function getDescriptionForEvent(string $eventName): string { switch ($eventName) { case 'created': $eventName = 'dibuat'; break; case 'updated': $eventName = 'diubah'; break; case 'deleted': $eventName = 'dihapus'; break; } if ($this->category == '0') { return "Berita '{$this->title}' telah {$eventName}"; } else { return "Pengumuman '{$this->title}' telah {$eventName}"; } } }