35 lines
864 B
PHP
35 lines
864 B
PHP
<?php
|
|
|
|
namespace App\Filament\Pages\Selections;
|
|
|
|
use Carbon\CarbonPeriod;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class LoadSeasons
|
|
{
|
|
public static function load($seasonmode)
|
|
{
|
|
if (!$seasonmode) {
|
|
return [];
|
|
}
|
|
|
|
$season = [];
|
|
$period = CarbonPeriod::create(Carbon::now()->year(2024), '1 year', Carbon::now());
|
|
foreach ($period as $date) {
|
|
if ($seasonmode == 'halfyear') {
|
|
if ((int) date('m') > 7)
|
|
$tmp = $date->format('y') . '/' . $date->format('y') + 1;
|
|
else
|
|
$tmp = $date->format('y') - 1 . '/' . $date->format('y');
|
|
$season[$tmp] = $tmp;
|
|
} else {
|
|
$season[$date->year] = $date->year;
|
|
}
|
|
}
|
|
|
|
$season = array_reverse($season);
|
|
|
|
return $season;
|
|
}
|
|
}
|