'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime' ]; /** * Scope untuk filter sentimen positif */ public function scopePositif($query) { return $query->where('sentiment', 'positif'); } /** * Scope untuk filter sentimen negatif */ public function scopeNegatif($query) { return $query->where('sentiment', 'negatif'); } /** * Scope untuk filter berdasarkan score */ public function scopeScoreRange($query, $min, $max) { return $query->whereBetween('score', [$min, $max]); } /** * Get sentiment badge class untuk styling */ public function getSentimentBadgeClassAttribute() { return $this->sentiment === 'positif' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'; } /** * Get sentiment in uppercase */ public function getSentimentUppercaseAttribute() { return strtoupper($this->sentiment); } }