fix season
This commit is contained in:
1 parent
d220e340e2
commit
7e30e93f90
5 files changed
+56
-48
No files matched your search
@@ -2,30 +2,33 @@
|
||||
|
||||
namespace App\Filament\Pages\Selections;
|
||||
|
||||
use App\Models\SofaScoreCategory;
|
||||
use App\Models\StatistikoEvent;
|
||||
use Carbon\CarbonPeriod;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class LoadSeasons
|
||||
{
|
||||
public static function load($sofascore_category_id)
|
||||
public static function load($seasonmode)
|
||||
{
|
||||
if(!$sofascore_category_id){
|
||||
if (!$seasonmode) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$season_mode = SofaScoreCategory::where('id', $sofascore_category_id)->value('season_mode');
|
||||
|
||||
$arr = [];
|
||||
if($season_mode == 'fullyear') {
|
||||
$arr[2024] = 2024;
|
||||
$arr[2025] = 2025;
|
||||
$arr[2026] = 2026;
|
||||
}else {
|
||||
$arr['24/25'] = '24/25';
|
||||
$arr['25/26'] = '25/26';
|
||||
$arr['26/27'] = '26/27';
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
return $arr;
|
||||
$season = array_reverse($season);
|
||||
|
||||
return $season;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user