'boolean', 'is_active' => 'boolean', ]; /** * Relação com o centro de custo */ public function costCenter(): BelongsTo { return $this->belongsTo(CostCenter::class); } /** * Scope para keywords ativas */ public function scopeActive($query) { return $query->where('is_active', true); } /** * Verifica se o texto contém esta palavra-chave */ public function matchesText(string $text): bool { if ($this->is_case_sensitive) { return str_contains($text, $this->keyword); } return str_contains(strtolower($text), strtolower($this->keyword)); } }