Finanzverwaltung und Saison-System

Neues Einnahmen-/Ausgaben-Modul mit Kategorie-Filter, Monats-Charts und
Saison-basierter Filterung. Saison-Verwaltung im Admin-Bereich mit
Möglichkeit zum Wechsel der aktuellen Saison.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Rhino
2026-03-02 23:48:20 +01:00
parent 480e2284ba
commit 4eaf2368af
18 changed files with 1270 additions and 1 deletions

38
app/Models/Finance.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
namespace App\Models;
use App\Enums\FinanceCategory;
use App\Enums\FinanceType;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Finance extends Model
{
protected $fillable = ['team_id', 'type', 'category', 'title', 'amount', 'date', 'notes'];
protected function casts(): array
{
return [
'type' => FinanceType::class,
'category' => FinanceCategory::class,
'date' => 'date',
'amount' => 'integer',
];
}
public function team(): BelongsTo
{
return $this->belongsTo(Team::class);
}
public function creator(): BelongsTo
{
return $this->belongsTo(User::class, 'created_by');
}
public function getFormattedAmountAttribute(): string
{
return number_format($this->amount / 100, 2, ',', '.') . ' €';
}
}

34
app/Models/Season.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Season extends Model
{
protected $fillable = ['name', 'start_date', 'end_date', 'is_current'];
protected function casts(): array
{
return [
'start_date' => 'date',
'end_date' => 'date',
'is_current' => 'boolean',
];
}
public function scopeCurrent($query)
{
return $query->where('is_current', true);
}
public static function current(): ?self
{
return static::where('is_current', true)->first();
}
public static function options(): array
{
return static::orderByDesc('start_date')->pluck('name', 'id')->toArray();
}
}