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:
38
app/Models/Finance.php
Normal file
38
app/Models/Finance.php
Normal 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, ',', '.') . ' €';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user