StreamTypeEnum::class, 'frequency' => StreamFrequencyEnum::class, 'amount' => 'integer', 'start_date' => 'date', 'end_date' => 'date', 'is_active' => 'boolean', ]; public function scenario(): BelongsTo { return $this->belongsTo(Scenario::class); } public function bucket(): BelongsTo { return $this->belongsTo(Bucket::class); } public static function getTypes(): array { return StreamTypeEnum::labels(); } public static function getFrequencies(): array { return StreamFrequencyEnum::labels(); } public function getTypeLabel(): string { return $this->type?->label() ?? ''; } public function getFrequencyLabel(): string { return $this->frequency?->label() ?? ''; } public function getMonthlyEquivalent(): float { if (!$this->frequency) { return 0; } return $this->amount * $this->frequency->getMonthlyEquivalentMultiplier(); } /* SCOPES */ public function scopeByType($query, string $type) { return $query->where('type', $type); } }