diff --git a/app/Console/Commands/Grapper/Sofascore.php b/app/Console/Commands/Grapper/Sofascore.php index 1b63f9d9..bfa0f022 100644 --- a/app/Console/Commands/Grapper/Sofascore.php +++ b/app/Console/Commands/Grapper/Sofascore.php @@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper; use App\Console\Commands\Grapper\Sofascore\Grapper; use App\Console\Commands\Grapper\Sofascore\Helper\Strings; use App\Console\Commands\Grapper\Sofascore\PlayerPerSeason; +use App\Console\Commands\Grapper\Sofascore\Rose; use App\Console\Commands\Grapper\Sofascore\SendMail; use App\Console\Commands\Grapper\Sofascore\SettingsToLocal; use App\Console\Commands\Nuh; @@ -47,6 +48,10 @@ class Sofascore SendMail::run(); break; + case 6: + Rose::run(); + break; + default: Notice::note('id not valid', 'br', 1); } diff --git a/app/Console/Commands/Grapper/Sofascore/Grapper.php b/app/Console/Commands/Grapper/Sofascore/Grapper.php index 3d9cc527..6a30dad3 100644 --- a/app/Console/Commands/Grapper/Sofascore/Grapper.php +++ b/app/Console/Commands/Grapper/Sofascore/Grapper.php @@ -59,7 +59,7 @@ class Grapper $day = $d['day']; if ($debug) { - Notice::note($day . ' - ' . $tournament->tournament->name, 'b'); + Notice::note('Start ' . $tournament->tournament->name, 'b'); } $res = SofaScoreDayTournament::whereDate('day', '=', $day)->where('tournament_id', $tournament->sofa_score_tournament_id)->first(); @@ -101,7 +101,7 @@ class Grapper Sleeper::rand(1); if ($debug) { - Notice::note('New ' . $day . ' - ' . $event['homeTeam']['name'] . ' vs ' . $event['awayTeam']['name'], 'bg'); + Notice::note($day . ' - ' . $event['homeTeam']['name'] . ' vs ' . $event['awayTeam']['name'], 'bg'); } $grapped = SofaScoreEventGrapped::firstOrNew(['id' => $event['id']]); diff --git a/app/Console/Commands/Grapper/Sofascore/PlayerPerSeason.php b/app/Console/Commands/Grapper/Sofascore/PlayerPerSeason.php index 440d0449..a2ae7e25 100644 --- a/app/Console/Commands/Grapper/Sofascore/PlayerPerSeason.php +++ b/app/Console/Commands/Grapper/Sofascore/PlayerPerSeason.php @@ -17,41 +17,40 @@ class PlayerPerSeason $res = StatistikoDetail::query()->select('tm_player_id', 'txodds_id')->get(); if ($debug) { - Notice::note('process '.$res->count() ." player", 'bb'); + Notice::note('process ' . $res->count() . " player", 'bb'); } foreach ($res as $val) { - + $collection = []; $res2 = StatistikoPlayer::with('event')->where('tm_player_id', $val->tm_player_id)->get(); - + foreach ($res2 as $val2) { - - if(!isset($collection[$val2->event->season])){ + + if (!isset($collection[$val2->event->season])) { $collection[$val2->event->season]['events_played_home'] = 0; $collection[$val2->event->season]['events_played_away'] = 0; $collection[$val2->event->season]['minutes_played_home'] = 0; $collection[$val2->event->season]['minutes_played_away'] = 0; } - if($val2->minutes_played > 0){ - if($val->txodds_id == $val2->event->home_id){ + if ($val2->minutes_played > 0) { + if ($val->txodds_id == $val2->event->home_id) { $collection[$val2->event->season]['events_played_home'] += 1; $collection[$val2->event->season]['minutes_played_home'] += $val2->minutes_played; - } - else if($val->txodds_id == $val2->event->away_id){ + } else if ($val->txodds_id == $val2->event->away_id) { $collection[$val2->event->season]['events_played_away'] += 1; $collection[$val2->event->season]['minutes_played_away'] += $val2->minutes_played; } } } - + foreach ($collection as $season => $row) { - if($val->txodds_id && $val->tm_player_id){ + if ($val->txodds_id && $val->tm_player_id) { SofaScorePlayerPerSeason::updateOrCreate( [ - 'tm_player_id' => $val->tm_player_id, - 'tx_team_id' => $val->txodds_id, + 'tm_player_id' => $val->tm_player_id, + 'tx_team_id' => $val->txodds_id, 'season' => $season ], [ diff --git a/app/Console/Commands/Grapper/Sofascore/Rose.php b/app/Console/Commands/Grapper/Sofascore/Rose.php new file mode 100644 index 00000000..644c140d --- /dev/null +++ b/app/Console/Commands/Grapper/Sofascore/Rose.php @@ -0,0 +1,32 @@ +components([ + // + ]); + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreRosas/SofaScoreRosaResource.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreRosas/SofaScoreRosaResource.php new file mode 100644 index 00000000..44647e39 --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreRosas/SofaScoreRosaResource.php @@ -0,0 +1,53 @@ + ListSofaScoreRosas::route('/'), + 'create' => CreateSofaScoreRosa::route('/create'), + 'edit' => EditSofaScoreRosa::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreRosas/Tables/SofaScoreRosasTable.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreRosas/Tables/SofaScoreRosasTable.php new file mode 100644 index 00000000..29a7af6b --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreRosas/Tables/SofaScoreRosasTable.php @@ -0,0 +1,30 @@ +columns([ + // + ]) + ->filters([ + // + ]) + ->recordActions([ + EditAction::make(), + ]) + ->toolbarActions([ + BulkActionGroup::make([ + DeleteBulkAction::make(), + ]), + ]); + } +} diff --git a/app/Models/SofaScoreRose.php b/app/Models/SofaScoreRose.php new file mode 100644 index 00000000..7c36fc1b --- /dev/null +++ b/app/Models/SofaScoreRose.php @@ -0,0 +1,10 @@ +id(); + $table->integer('country_id')->default(0)->nullable()->index()->references('id')->on('countries'); + $table->integer('ssteam_id'); + $table->string('ssteam_name'); + $table->boolean('is_active')->default(false); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('sofa_score_roses'); + } +}; diff --git a/grapper.sh b/grapper.sh index 28f956d6..533eeef8 100755 --- a/grapper.sh +++ b/grapper.sh @@ -4,7 +4,9 @@ case "$1" in echo "--------------------------" echo "GRAPPER SOFASCORE" echo "--------------------------" - echo "parameter sofa_score_tasks ID" + echo "parameter ID" + echo "--fun = Sofascore.php switch() " + echo "--task = sofa_score_tasks_id" echo "yesterday 1" echo "dates 2" echo "--------------------------"