'boolean' ]; /** * Ottieni il codice completo (MASTRO-CONTO-SOTTOCONTO) */ public function getCodiceCompletoAttribute(): string { return "{$this->mastro}-{$this->conto}-{$this->sottoconto}"; } /** * Scope per filtro per mastro */ public function scopePerMastro($query, string $mastro) { return $query->where('mastro', $mastro); } /** * Scope per filtro per conto */ public function scopePerConto($query, string $mastro, string $conto) { return $query->where('mastro', $mastro)->where('conto', $conto); } /** * Scope solo attivi */ public function scopeAttivi($query) { return $query->where('attivo', true); } /** * Relazione con le voci spesa */ public function vociSpesa(): HasMany { return $this->hasMany(VoceSpesaMillesimale::class, 'piano_conti_id'); } }