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>
35 lines
725 B
PHP
35 lines
725 B
PHP
<?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();
|
|
}
|
|
}
|