This commit is contained in:
salam committed 2026-09-23 16:33:26 +02:00
1 parent b74c374586
commit 1a46e5d887
6 files changed
+60 -18

No files matched your search

+12
View File
@@ -14,6 +14,18 @@ class LoadSofaScoreCategory
->groupBy('league_id') ->groupBy('league_id')
->pluck('league_id')->toArray(); ->pluck('league_id')->toArray();
/*
0 => 24
1 => 25
2 => 54
3 => 131
4 => 192
5 => 242
6 => 406
7 => 11539
8 => 11621
*/
$sofa_score_category_id = SofaScoreTournament::whereIn('tournament_id', $league_ids)->pluck('sofa_score_category_id')->toArray(); $sofa_score_category_id = SofaScoreTournament::whereIn('tournament_id', $league_ids)->pluck('sofa_score_category_id')->toArray();
$sofa_score_category_id = array_unique($sofa_score_category_id); $sofa_score_category_id = array_unique($sofa_score_category_id);
@@ -2,16 +2,23 @@
namespace App\Actions; namespace App\Actions;
use App\Models\SofaScoreTournament; use App\Models\StatisticFixtures;
class LoadStatisticFixturesLeaguesOptions class LoadStatisticFixturesLeaguesOptions
{ {
public static function load(int|null $sofascore_category_id = 0) public static function load(?int $sofascore_category_id = 0)
{ {
// $res = StatisticFixtures::with('league')->where('league_id', $sofascore_category_id) $res = StatisticFixtures::with('league')
// ->groupBy('league_id') ->whereHas('league', function ($query) use ($sofascore_category_id) {
// ->pluck('league_id')->toArray(); $query->where('sofa_score_category_id', $sofascore_category_id);
})
->get();
return SofaScoreTournament::where('enabled', 1)->where('sofa_score_category_id', $sofascore_category_id)->orderBy('name')->pluck('name', 'tournament_id'); $arr = [];
foreach ($res as $value) {
$arr[$value->league_id] = $value->league->name;
}
return $arr;
} }
} }
+5 -5
View File
@@ -143,7 +143,7 @@ class Statistic extends BaseDashboard
->prefixIcon('phosphor-globe-fill') ->prefixIcon('phosphor-globe-fill')
->hiddenLabel() ->hiddenLabel()
->options(fn () => LoadSofaScoreCategory::load()) ->options(fn () => LoadSofaScoreCategory::load())
->placeholder('Country') ->placeholder('Select Country')
->afterStateUpdated(function (callable $set, $state) { ->afterStateUpdated(function (callable $set, $state) {
$set('seasonmode', SofaScoreCategory::where('id', $state)->value('season_mode')); $set('seasonmode', SofaScoreCategory::where('id', $state)->value('season_mode'));
$set('league_id', null); $set('league_id', null);
@@ -159,7 +159,7 @@ class Statistic extends BaseDashboard
->prefixIcon('phosphor-trophy-fill') ->prefixIcon('phosphor-trophy-fill')
->hiddenLabel() ->hiddenLabel()
->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id'))) ->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
->placeholder('League') ->placeholder('Select League')
->afterStateUpdated(function (callable $set) { ->afterStateUpdated(function (callable $set) {
$set('match_id', null); $set('match_id', null);
$set('team_id', null); $set('team_id', null);
@@ -180,7 +180,7 @@ class Statistic extends BaseDashboard
$set('ss_player_id', null); $set('ss_player_id', null);
$this->dispatch('reset-tab'); $this->dispatch('reset-tab');
}) })
->placeholder('Events'), ->placeholder('Select Event'),
Select::make('team_id') Select::make('team_id')
->live() ->live()
@@ -213,12 +213,12 @@ class Statistic extends BaseDashboard
$set('ss_player_id', null); $set('ss_player_id', null);
$this->dispatch('reset-tab'); $this->dispatch('reset-tab');
}) })
->placeholder('Team'), ->placeholder('Select Team'),
Select::make('team_position') Select::make('team_position')
->live() ->live()
->hiddenLabel() ->hiddenLabel()
->placeholder('Team Position') ->placeholder('Select Team Position')
->prefix('TP') ->prefix('TP')
->prefixAction( ->prefixAction(
Action::make('iconInfo') Action::make('iconInfo')
+4 -4
View File
@@ -2,12 +2,12 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperStatisticType;
use App\Filament\Widgets\Data\LoadEvents;
use Filament\Support\RawJs; use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Livewire\Attributes\Reactive;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
use App\Filament\Widgets\Data\LoadEvents; use Livewire\Attributes\Reactive;
use App\Filament\Widgets\Data\HelperStatisticType;
class ChartEvent extends ChartWidget class ChartEvent extends ChartWidget
{ {
@@ -28,7 +28,7 @@ class ChartEvent extends ChartWidget
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" viewBox="0 0 256 256"><path d="M232,64H208V48a8,8,0,0,0-8-8H56a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80V96a40,40,0,0,0,40,40h3.65A80.13,80.13,0,0,0,120,191.61V216H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16H136V191.58c31.94-3.23,58.44-25.64,68.08-55.58H208a40,40,0,0,0,40-40V80A16,16,0,0,0,232,64ZM48,120A24,24,0,0,1,24,96V80H48v32q0,4,.39,8Zm144-8.9c0,35.52-29,64.64-64,64.9a64,64,0,0,1-64-64V56H192ZM232,96a24,24,0,0,1-24,24h-.5a81.81,81.81,0,0,0,.5-8.9V80h24Z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" viewBox="0 0 256 256"><path d="M232,64H208V48a8,8,0,0,0-8-8H56a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80V96a40,40,0,0,0,40,40h3.65A80.13,80.13,0,0,0,120,191.61V216H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16H136V191.58c31.94-3.23,58.44-25.64,68.08-55.58H208a40,40,0,0,0,40-40V80A16,16,0,0,0,232,64ZM48,120A24,24,0,0,1,24,96V80H48v32q0,4,.39,8Zm144-8.9c0,35.52-29,64.64-64,64.9a64,64,0,0,1-64-64V56H192ZM232,96a24,24,0,0,1-24,24h-.5a81.81,81.81,0,0,0,.5-8.9V80h24Z"></path></svg>
Events Events
</span> </span>
<span>' . $this->type . '</span> <span>'.$this->type.'</span>
</span> </span>
'); ');
} }
+9 -2
View File
@@ -1,7 +1,14 @@
<?php <?php
test('the application returns a successful response', function () { use App\Models\User;
$response = $this->get('/'); use Tests\TestCase;
/** @var TestCase $this */
it('the application returns a successful response', function () {
// Create a temporary user and log them in
$user = User::factory()->create();
$response = $this->actingAs($user)->get('/');
$response->assertStatus(200); $response->assertStatus(200);
}); });
+17 -1
View File
@@ -1,5 +1,16 @@
<?php <?php
use App\Models\User;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\TestCase;
// tests/Pest.php
uses(
TestCase::class,
LazilyRefreshDatabase::class,
)->in('Feature');
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Test Case | Test Case
@@ -11,7 +22,7 @@
| |
*/ */
pest()->extend(Tests\TestCase::class) pest()->extend(TestCase::class)
// ->use(Illuminate\Foundation\Testing\RefreshDatabase::class) // ->use(Illuminate\Foundation\Testing\RefreshDatabase::class)
->in('Feature'); ->in('Feature');
@@ -30,6 +41,11 @@ expect()->extend('toBeOne', function () {
return $this->toBe(1); return $this->toBe(1);
}); });
test('the application returns a successful response')
->actingAs(User::factory()->create())
->get('/')
->assertStatus(200);
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Functions | Functions