NEW FEATURES: - Financial Health: Score 0-100, 6 metrics, insights, recommendations - Goals: Create/edit savings goals, contributions, progress tracking - Budgets: Monthly category limits, usage alerts, year summary - Reports: 7 tabs with charts (category, evolution, projection, etc.) BACKEND: - New models: FinancialGoal, GoalContribution, Budget - New controllers: FinancialHealthController, FinancialGoalController, BudgetController, ReportController - New migrations: financial_goals, goal_contributions, budgets FRONTEND: - New pages: FinancialHealth.jsx, Goals.jsx, Budgets.jsx, Reports.jsx - New services: financialHealthService, financialGoalService, budgetService, reportService - Navigation: New 'Planning' group in sidebar Chart.js integration for all visualizations
39 lines
786 B
PHP
39 lines
786 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class GoalContribution extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'financial_goal_id',
|
|
'transaction_id',
|
|
'amount',
|
|
'contribution_date',
|
|
'notes',
|
|
];
|
|
|
|
protected $casts = [
|
|
'amount' => 'decimal:2',
|
|
'contribution_date' => 'date',
|
|
];
|
|
|
|
// ============================================
|
|
// Relaciones
|
|
// ============================================
|
|
|
|
public function goal()
|
|
{
|
|
return $this->belongsTo(FinancialGoal::class, 'financial_goal_id');
|
|
}
|
|
|
|
public function transaction()
|
|
{
|
|
return $this->belongsTo(Transaction::class);
|
|
}
|
|
}
|