From 5926e4e22633d2531dac724b2559cc21e2de7eea Mon Sep 17 00:00:00 2001 From: salam Date: Mon, 12 Oct 2026 08:35:42 +0200 Subject: [PATCH] fix update pre calc player by action --- app/Console/Commands/Grapper.php | 2 +- app/Console/Commands/GrapperDaily.php | 4 +- .../Commands/{Upd.php => PreCalcPlayer.php} | 6 +- .../Pages/ListStatistikoImports.php | 21 +- app/Traits/UpdateHelper.php | 460 +++++++----------- config/queue.php | 2 +- resources/views/mail/simple.blade.php | 1 - 7 files changed, 190 insertions(+), 306 deletions(-) rename app/Console/Commands/{Upd.php => PreCalcPlayer.php} (71%) diff --git a/app/Console/Commands/Grapper.php b/app/Console/Commands/Grapper.php index 13d3ae17..871ec577 100644 --- a/app/Console/Commands/Grapper.php +++ b/app/Console/Commands/Grapper.php @@ -11,7 +11,7 @@ class Grapper extends Command protected $signature = 'grp:sofa {--d} {--r} {--f}'; - protected $description = 'grap sofascore selecting'; + protected $description = 'grap select function'; public function handleGrapper(): void { diff --git a/app/Console/Commands/GrapperDaily.php b/app/Console/Commands/GrapperDaily.php index a3d1d99a..e74eef64 100644 --- a/app/Console/Commands/GrapperDaily.php +++ b/app/Console/Commands/GrapperDaily.php @@ -9,9 +9,9 @@ class GrapperDaily extends Command { use GrappingSofascore; - protected $signature = 'grp:daily {--d} {--r} {--f}'; + protected $signature = 'grp:day {--d} {--r} {--f}'; - protected $description = 'grap sofascore daily'; + protected $description = 'grap daily'; public function handleGrapper(): void { diff --git a/app/Console/Commands/Upd.php b/app/Console/Commands/PreCalcPlayer.php similarity index 71% rename from app/Console/Commands/Upd.php rename to app/Console/Commands/PreCalcPlayer.php index bbcb6361..0180a486 100644 --- a/app/Console/Commands/Upd.php +++ b/app/Console/Commands/PreCalcPlayer.php @@ -5,13 +5,13 @@ namespace App\Console\Commands; use App\Traits\UpdateHelper; use Illuminate\Console\Command; -class Upd extends Command +class PreCalcPlayer extends Command { use UpdateHelper; - protected $signature = 'update:player {--d}'; + protected $signature = 'grp:ply {--d}'; - protected $description = 'update ss_player_seasons'; + protected $description = 'player pre calculations'; public function handleUpdate(int $playerCount): void { diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Pages/ListStatistikoImports.php b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Pages/ListStatistikoImports.php index 0e7e85c1..f616f083 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Pages/ListStatistikoImports.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Pages/ListStatistikoImports.php @@ -4,10 +4,8 @@ namespace App\Filament\Clusters\StaticData\Resources\StatistikoImports\Pages; use App\Filament\Clusters\StaticData\Resources\StatistikoImports\StatistikaImportResource; use App\Models\StatistikoImport; -use App\Models\User; use Filament\Actions\Action; use Filament\Actions\CreateAction; -use Filament\Notifications\Notification; use Filament\Resources\Pages\ListRecords; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\File; @@ -22,16 +20,17 @@ class ListStatistikoImports extends ListRecords Action::make('precalculation')->color('success') ->icon('phosphor-gear') ->requiresConfirmation() // Optional: Asks user before running - ->action(function () { - // Run the console command + ->modalClickThrough() + ->action(function (Action $action) { + // Wir registrieren einen Shutdown-Terminating-Job, + // damit Filament die HTTP-Antwort an den Browser senden kann, + // BEVOR der speicherhungrige Befehl startet. + app()->terminating(function () { + Artisan::call('grp:ply'); + }); - Artisan::queue('update:player'); - - // Notify the user of success - Notification::make() - ->title('Background process started') - ->body('This may take a few minutes. We will notify you when it is finished.') - ->info(); + // Schließt das Modal SOFORT im Browser + $action->close(); }), CreateAction::make('upload_file') ->modalIcon('phosphor-upload') diff --git a/app/Traits/UpdateHelper.php b/app/Traits/UpdateHelper.php index 0772e751..d04c4291 100644 --- a/app/Traits/UpdateHelper.php +++ b/app/Traits/UpdateHelper.php @@ -28,8 +28,12 @@ trait UpdateHelper public function handle(): void { error_reporting(E_ALL); + ini_set('memory_limit', '2048M'); ini_set('display_errors', 1); - + /** + * ps aux | grep artisan + * kill -9 12345 + */ $tmp = $this->options(); $this->debug = $tmp['d'] ?? 0; @@ -41,6 +45,7 @@ trait UpdateHelper $playerCount = $this->selectPlayer(); } else { $playerCount = 1000000; + $playerCount = 1000; } if ($this->debug) { @@ -116,303 +121,184 @@ trait UpdateHelper protected function updatePlayers(int $playerCount) { - StatistikoDetail::chunk(500, function ($details) { - foreach ($details as $chunk) { - $res = StatistikoPlayer::with('event')->with('details')->whereIn('ss_player_id', $chunk)->orderBy('ss_player_id')->get(); + $res_player = StatistikoDetail::query()->where('is_active', 1)->limit($playerCount)->pluck('ss_player_id')->toArray(); - $collection = []; - foreach ($res as $val) { + $chunks = array_chunk($res_player, 500); - if (isset($val->event)) { + foreach ($chunks as $chunk) { - $ss_player_id = (int) $val->ss_player_id; - $activeteam_id = (int) $val->activeteam_id; - $minutes_played = (int) $val->minutes_played; - // $ss_team_id = (int) $val->details->ss_team_id; - $season = $val->event->season; - $home_id = (int) $val->event->home_id; - $away_id = (int) $val->event->away_id; - $startime = $val->event->starttime; - - if ($startime->greaterThan(now()->subDays(180))) { - $last_180_days = true; - } else { - $last_180_days = false; - } - - if (! isset($collection[$season][$ss_player_id])) { - $this->array_template($collection, $ss_player_id, $season); - } - if (! isset($collection['total'][$ss_player_id])) { - $this->array_template($collection, $ss_player_id, 'total'); - } - if (! isset($collection['last_180_days'][$ss_player_id])) { - $this->array_template($collection, $ss_player_id, 'last_180_days'); - } - - if ($minutes_played > 0) { - if ($activeteam_id == $home_id) { - $collection[$season][$ss_player_id]['events_played_home'] += 1; - $collection[$season][$ss_player_id]['minutes_played_home'] += $minutes_played; - $collection['total'][$ss_player_id]['events_played_home'] += 1; - $collection['total'][$ss_player_id]['minutes_played_home'] += $minutes_played; - if ($last_180_days) { - $collection['last_180_days'][$ss_player_id]['events_played_home'] += 1; - $collection['last_180_days'][$ss_player_id]['minutes_played_home'] += $minutes_played; - } - } elseif ($activeteam_id == $away_id) { - $collection[$season][$ss_player_id]['events_played_away'] += 1; - $collection[$season][$ss_player_id]['minutes_played_away'] += $minutes_played; - $collection['total'][$ss_player_id]['events_played_away'] += 1; - $collection['total'][$ss_player_id]['minutes_played_away'] += $minutes_played; - if ($last_180_days) { - $collection['last_180_days'][$ss_player_id]['events_played_away'] += 1; - $collection['last_180_days'][$ss_player_id]['minutes_played_away'] += $minutes_played; - } - - } - // ubaldo 18. Sep 26 intanto vado avanti, appena trovo qwuaqlcosa ti scrivo, tu togli i red cards dal conteggio - $cards = $val->card_yellow + $val->card_yellowred; - - $collection[$season][$ss_player_id]['ss_player_id'] = $ss_player_id; - // $collection[$season][$ss_player_id]['ss_team_id'] = $ss_team_id; - $collection[$season][$ss_player_id]['season'] = $season; - $collection[$season][$ss_player_id]['total_events']++; - $collection[$season][$ss_player_id]['total_min'] += $minutes_played; - $collection[$season][$ss_player_id]['average_min'] = round($collection[$season][$ss_player_id]['total_min'] / $collection[$season][$ss_player_id]['total_events']); - $collection[$season][$ss_player_id]['goals'] += $val->goals; - $collection[$season][$ss_player_id]['fouls'] += $val->fouls; - $collection[$season][$ss_player_id]['cards'] += $cards; - $collection[$season][$ss_player_id]['offsides'] += $val->offsides; - $collection[$season][$ss_player_id]['shots_on_target'] += $val->shots_on_target; - $collection[$season][$ss_player_id]['shots_off_target'] += $val->shots_off_target; - $collection[$season][$ss_player_id]['shots_blocked'] += $val->shots_blocked; - $collection[$season][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked; - - $collection['total'][$ss_player_id]['ss_player_id'] = $ss_player_id; - // $collection['total'][$ss_player_id]['ss_team_id'] = $ss_team_id; - $collection['total'][$ss_player_id]['season'] = 'total'; - $collection['total'][$ss_player_id]['total_events']++; - $collection['total'][$ss_player_id]['total_min'] += $minutes_played; - $collection['total'][$ss_player_id]['average_min'] = round($collection['total'][$ss_player_id]['total_min'] / $collection['total'][$ss_player_id]['total_events']); - $collection['total'][$ss_player_id]['goals'] += $val->goals; - $collection['total'][$ss_player_id]['fouls'] += $val->fouls; - $collection['total'][$ss_player_id]['cards'] += $cards; - $collection['total'][$ss_player_id]['offsides'] += $val->offsides; - $collection['total'][$ss_player_id]['shots_on_target'] += $val->shots_on_target; - $collection['total'][$ss_player_id]['shots_off_target'] += $val->shots_off_target; - $collection['total'][$ss_player_id]['shots_blocked'] += $val->shots_blocked; - $collection['total'][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked; - - if ($last_180_days) { - $collection['last_180_days'][$ss_player_id]['ss_player_id'] = $ss_player_id; - // $collection['last_180_days'][$ss_player_id]['ss_team_id'] = $ss_team_id; - $collection['last_180_days'][$ss_player_id]['season'] = 'last_180_days'; - $collection['last_180_days'][$ss_player_id]['total_events']++; - $collection['last_180_days'][$ss_player_id]['total_min'] += $minutes_played; - $collection['last_180_days'][$ss_player_id]['average_min'] = round($collection['last_180_days'][$ss_player_id]['total_min'] / $collection['last_180_days'][$ss_player_id]['total_events']); - $collection['last_180_days'][$ss_player_id]['goals'] += $val->goals; - $collection['last_180_days'][$ss_player_id]['fouls'] += $val->fouls; - $collection['last_180_days'][$ss_player_id]['cards'] += $cards; - $collection['last_180_days'][$ss_player_id]['offsides'] += $val->offsides; - $collection['last_180_days'][$ss_player_id]['shots_on_target'] += $val->shots_on_target; - $collection['last_180_days'][$ss_player_id]['shots_off_target'] += $val->shots_off_target; - $collection['last_180_days'][$ss_player_id]['shots_blocked'] += $val->shots_blocked; - $collection['last_180_days'][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked; - } - } - } - } - - $collection_1d = []; - foreach ($collection as $arr) { - foreach ($arr as $row) { - $collection_1d[] = $row; - } - } - - SofaScorePlayerPerSeason::upsert( - $collection_1d, - uniqueBy: [ - 'ss_player_id', - // 'ss_team_id', - 'season', - ], - update: [ - 'total_events', - 'total_min', - 'average_min', - 'events_played_home', - 'events_played_away', - 'minutes_played_home', - 'minutes_played_away', - 'goals', - 'fouls', - 'offsides', - 'shots_on_target', - 'shots_off_target', - 'shots_blocked', - 'total_shots', - 'cards', - ] - ); + if ($this->debug) { + echo '#'; } - }); + $res = StatistikoPlayer::with('event')->with('details')->whereIn('ss_player_id', $chunk)->orderBy('ss_player_id')->get(); + + $collection = []; + foreach ($res as $val) { + + if (isset($val->event) && $val->ss_player_id != 0) { + + $ss_player_id = (int) $val->ss_player_id; + $activeteam_id = (int) $val->activeteam_id; + $minutes_played = (int) $val->minutes_played; + $season = $val->event->season; + $home_id = (int) $val->event->home_id; + $away_id = (int) $val->event->away_id; + $startime = $val->event->starttime; + + if ($startime->greaterThan(now()->subDays(180))) { + $last_180_days = true; + } else { + $last_180_days = false; + } + + if (! isset($collection[$season][$ss_player_id])) { + $this->array_template($collection, $ss_player_id, $season); + } + if (! isset($collection['total'][$ss_player_id])) { + $this->array_template($collection, $ss_player_id, 'total'); + } + if (! isset($collection['last_180_days'][$ss_player_id])) { + $this->array_template($collection, $ss_player_id, 'last_180_days'); + } + + if ($minutes_played > 0) { + if ($activeteam_id == $home_id) { + $collection[$season][$ss_player_id]['events_played_home'] += 1; + $collection[$season][$ss_player_id]['minutes_played_home'] += $minutes_played; + $collection['total'][$ss_player_id]['events_played_home'] += 1; + $collection['total'][$ss_player_id]['minutes_played_home'] += $minutes_played; + if ($last_180_days) { + $collection['last_180_days'][$ss_player_id]['events_played_home'] += 1; + $collection['last_180_days'][$ss_player_id]['minutes_played_home'] += $minutes_played; + } + } elseif ($activeteam_id == $away_id) { + $collection[$season][$ss_player_id]['events_played_away'] += 1; + $collection[$season][$ss_player_id]['minutes_played_away'] += $minutes_played; + $collection['total'][$ss_player_id]['events_played_away'] += 1; + $collection['total'][$ss_player_id]['minutes_played_away'] += $minutes_played; + if ($last_180_days) { + $collection['last_180_days'][$ss_player_id]['events_played_away'] += 1; + $collection['last_180_days'][$ss_player_id]['minutes_played_away'] += $minutes_played; + } + + } + // ubaldo 18. Sep 26 intanto vado avanti, appena trovo qwuaqlcosa ti scrivo, tu togli i red cards dal conteggio + $cards = $val->card_yellow + $val->card_yellowred; + + $collection[$season][$ss_player_id]['ss_player_id'] = $ss_player_id; + $collection[$season][$ss_player_id]['season'] = $season; + $collection[$season][$ss_player_id]['total_events']++; + $collection[$season][$ss_player_id]['total_min'] += $minutes_played; + $collection[$season][$ss_player_id]['average_min'] = round($collection[$season][$ss_player_id]['total_min'] / $collection[$season][$ss_player_id]['total_events']); + $collection[$season][$ss_player_id]['goals'] += $val->goals; + $collection[$season][$ss_player_id]['fouls'] += $val->fouls; + $collection[$season][$ss_player_id]['cards'] += $cards; + $collection[$season][$ss_player_id]['offsides'] += $val->offsides; + $collection[$season][$ss_player_id]['shots_on_target'] += $val->shots_on_target; + $collection[$season][$ss_player_id]['shots_off_target'] += $val->shots_off_target; + $collection[$season][$ss_player_id]['shots_blocked'] += $val->shots_blocked; + $collection[$season][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked; + + $collection['total'][$ss_player_id]['ss_player_id'] = $ss_player_id; + $collection['total'][$ss_player_id]['season'] = 'total'; + $collection['total'][$ss_player_id]['total_events']++; + $collection['total'][$ss_player_id]['total_min'] += $minutes_played; + $collection['total'][$ss_player_id]['average_min'] = round($collection['total'][$ss_player_id]['total_min'] / $collection['total'][$ss_player_id]['total_events']); + $collection['total'][$ss_player_id]['goals'] += $val->goals; + $collection['total'][$ss_player_id]['fouls'] += $val->fouls; + $collection['total'][$ss_player_id]['cards'] += $cards; + $collection['total'][$ss_player_id]['offsides'] += $val->offsides; + $collection['total'][$ss_player_id]['shots_on_target'] += $val->shots_on_target; + $collection['total'][$ss_player_id]['shots_off_target'] += $val->shots_off_target; + $collection['total'][$ss_player_id]['shots_blocked'] += $val->shots_blocked; + $collection['total'][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked; + + if ($last_180_days) { + $collection['last_180_days'][$ss_player_id]['ss_player_id'] = $ss_player_id; + $collection['last_180_days'][$ss_player_id]['season'] = 'last_180_days'; + $collection['last_180_days'][$ss_player_id]['total_events']++; + $collection['last_180_days'][$ss_player_id]['total_min'] += $minutes_played; + $collection['last_180_days'][$ss_player_id]['average_min'] = round($collection['last_180_days'][$ss_player_id]['total_min'] / $collection['last_180_days'][$ss_player_id]['total_events']); + $collection['last_180_days'][$ss_player_id]['goals'] += $val->goals; + $collection['last_180_days'][$ss_player_id]['fouls'] += $val->fouls; + $collection['last_180_days'][$ss_player_id]['cards'] += $cards; + $collection['last_180_days'][$ss_player_id]['offsides'] += $val->offsides; + $collection['last_180_days'][$ss_player_id]['shots_on_target'] += $val->shots_on_target; + $collection['last_180_days'][$ss_player_id]['shots_off_target'] += $val->shots_off_target; + $collection['last_180_days'][$ss_player_id]['shots_blocked'] += $val->shots_blocked; + $collection['last_180_days'][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked; + } + } + } + } + + $collection_1d = []; + foreach ($collection as $arr) { + foreach ($arr as $row) { + $collection_1d[] = $row; + } + } + + // ALTER TABLE ss_player_seasons ADD UNIQUE KEY eindeutiger_index (ss_player_id, season); + + SofaScorePlayerPerSeason::upsert( + $collection_1d, + uniqueBy: [ + 'ss_player_id', + 'season', + ], + update: [ + 'total_events', + 'total_min', + 'average_min', + 'events_played_home', + 'events_played_away', + 'minutes_played_home', + 'minutes_played_away', + 'goals', + 'fouls', + 'offsides', + 'shots_on_target', + 'shots_off_target', + 'shots_blocked', + 'total_shots', + 'cards', + ] + ); + } + + StatistikoPlayer::where('ss_player_id', 0)->delete(); + + // 1. Finde alle Kombinationen, die mehrfach existieren + $duplicates = DB::table('ss_player_seasons') + ->select('season', 'ss_player_id', DB::raw('COUNT(*) as count')) + ->groupBy('season', 'ss_player_id') + ->having('count', '>', 1) + ->get(); + + // 2. Schleife durch die Duplikate und lösche die überschüssigen + foreach ($duplicates as $duplicate) { + // Hol dir alle IDs für diese spezifische Kombination, sortiert nach ID + $ids = SofaScorePlayerPerSeason::where('season', $duplicate->season) + ->where('ss_player_id', $duplicate->ss_player_id) + ->orderBy('id', 'asc') + ->pluck('id'); + + // Behalte die erste ID (Index 0) und hole alle anderen + $idsToDelete = $ids->slice(1); + + // Lösche die überflüssigen IDs aus der Datenbank + SofaScorePlayerPerSeason::whereIn('id', $idsToDelete)->delete(); + } + + // Mail::to('hermann.telser@gmail.com')->send(new SimpleMail('STATISTIKO', 'Pre Calculation Completed')); Mail::to(['hermann.telser@gmail.com', 'ubaldo.perrucci@gmail.com'])->send(new SimpleMail('STATISTIKO', 'Pre Calculation Completed')); - - // ###################### - // $res_player = StatistikoDetail::query()->where('is_active', 1)->limit($playerCount)->pluck('ss_player_id')->toArray(); - - // $chunks = array_chunk($res_player, 500); - - // foreach ($chunks as $chunk) { - - // $res = StatistikoPlayer::with('event')->with('details')->whereIn('ss_player_id', $chunk)->orderBy('ss_player_id')->get(); - - // $collection = []; - // foreach ($res as $val) { - - // if (isset($val->event)) { - - // $ss_player_id = (int) $val->ss_player_id; - // $activeteam_id = (int) $val->activeteam_id; - // $minutes_played = (int) $val->minutes_played; - // // $ss_team_id = (int) $val->details->ss_team_id; - // $season = $val->event->season; - // $home_id = (int) $val->event->home_id; - // $away_id = (int) $val->event->away_id; - // $startime = $val->event->starttime; - - // if ($startime->greaterThan(now()->subDays(180))) { - // $last_180_days = true; - // } else { - // $last_180_days = false; - // } - - // if (! isset($collection[$season][$ss_player_id])) { - // $this->array_template($collection, $ss_player_id, $season); - // } - // if (! isset($collection['total'][$ss_player_id])) { - // $this->array_template($collection, $ss_player_id, 'total'); - // } - // if (! isset($collection['last_180_days'][$ss_player_id])) { - // $this->array_template($collection, $ss_player_id, 'last_180_days'); - // } - - // if ($minutes_played > 0) { - // if ($activeteam_id == $home_id) { - // $collection[$season][$ss_player_id]['events_played_home'] += 1; - // $collection[$season][$ss_player_id]['minutes_played_home'] += $minutes_played; - // $collection['total'][$ss_player_id]['events_played_home'] += 1; - // $collection['total'][$ss_player_id]['minutes_played_home'] += $minutes_played; - // if ($last_180_days) { - // $collection['last_180_days'][$ss_player_id]['events_played_home'] += 1; - // $collection['last_180_days'][$ss_player_id]['minutes_played_home'] += $minutes_played; - // } - // } elseif ($activeteam_id == $away_id) { - // $collection[$season][$ss_player_id]['events_played_away'] += 1; - // $collection[$season][$ss_player_id]['minutes_played_away'] += $minutes_played; - // $collection['total'][$ss_player_id]['events_played_away'] += 1; - // $collection['total'][$ss_player_id]['minutes_played_away'] += $minutes_played; - // if ($last_180_days) { - // $collection['last_180_days'][$ss_player_id]['events_played_away'] += 1; - // $collection['last_180_days'][$ss_player_id]['minutes_played_away'] += $minutes_played; - // } - - // } - // // ubaldo 18. Sep 26 intanto vado avanti, appena trovo qwuaqlcosa ti scrivo, tu togli i red cards dal conteggio - // $cards = $val->card_yellow + $val->card_yellowred; - - // $collection[$season][$ss_player_id]['ss_player_id'] = $ss_player_id; - // // $collection[$season][$ss_player_id]['ss_team_id'] = $ss_team_id; - // $collection[$season][$ss_player_id]['season'] = $season; - // $collection[$season][$ss_player_id]['total_events']++; - // $collection[$season][$ss_player_id]['total_min'] += $minutes_played; - // $collection[$season][$ss_player_id]['average_min'] = round($collection[$season][$ss_player_id]['total_min'] / $collection[$season][$ss_player_id]['total_events']); - // $collection[$season][$ss_player_id]['goals'] += $val->goals; - // $collection[$season][$ss_player_id]['fouls'] += $val->fouls; - // $collection[$season][$ss_player_id]['cards'] += $cards; - // $collection[$season][$ss_player_id]['offsides'] += $val->offsides; - // $collection[$season][$ss_player_id]['shots_on_target'] += $val->shots_on_target; - // $collection[$season][$ss_player_id]['shots_off_target'] += $val->shots_off_target; - // $collection[$season][$ss_player_id]['shots_blocked'] += $val->shots_blocked; - // $collection[$season][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked; - - // $collection['total'][$ss_player_id]['ss_player_id'] = $ss_player_id; - // // $collection['total'][$ss_player_id]['ss_team_id'] = $ss_team_id; - // $collection['total'][$ss_player_id]['season'] = 'total'; - // $collection['total'][$ss_player_id]['total_events']++; - // $collection['total'][$ss_player_id]['total_min'] += $minutes_played; - // $collection['total'][$ss_player_id]['average_min'] = round($collection['total'][$ss_player_id]['total_min'] / $collection['total'][$ss_player_id]['total_events']); - // $collection['total'][$ss_player_id]['goals'] += $val->goals; - // $collection['total'][$ss_player_id]['fouls'] += $val->fouls; - // $collection['total'][$ss_player_id]['cards'] += $cards; - // $collection['total'][$ss_player_id]['offsides'] += $val->offsides; - // $collection['total'][$ss_player_id]['shots_on_target'] += $val->shots_on_target; - // $collection['total'][$ss_player_id]['shots_off_target'] += $val->shots_off_target; - // $collection['total'][$ss_player_id]['shots_blocked'] += $val->shots_blocked; - // $collection['total'][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked; - - // if ($last_180_days) { - // $collection['last_180_days'][$ss_player_id]['ss_player_id'] = $ss_player_id; - // // $collection['last_180_days'][$ss_player_id]['ss_team_id'] = $ss_team_id; - // $collection['last_180_days'][$ss_player_id]['season'] = 'last_180_days'; - // $collection['last_180_days'][$ss_player_id]['total_events']++; - // $collection['last_180_days'][$ss_player_id]['total_min'] += $minutes_played; - // $collection['last_180_days'][$ss_player_id]['average_min'] = round($collection['last_180_days'][$ss_player_id]['total_min'] / $collection['last_180_days'][$ss_player_id]['total_events']); - // $collection['last_180_days'][$ss_player_id]['goals'] += $val->goals; - // $collection['last_180_days'][$ss_player_id]['fouls'] += $val->fouls; - // $collection['last_180_days'][$ss_player_id]['cards'] += $cards; - // $collection['last_180_days'][$ss_player_id]['offsides'] += $val->offsides; - // $collection['last_180_days'][$ss_player_id]['shots_on_target'] += $val->shots_on_target; - // $collection['last_180_days'][$ss_player_id]['shots_off_target'] += $val->shots_off_target; - // $collection['last_180_days'][$ss_player_id]['shots_blocked'] += $val->shots_blocked; - // $collection['last_180_days'][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked; - // } - // } - // } - // } - - // $collection_1d = []; - // foreach ($collection as $arr) { - // foreach ($arr as $row) { - // $collection_1d[] = $row; - // } - // } - - // SofaScorePlayerPerSeason::upsert( - // $collection_1d, - // uniqueBy: [ - // 'ss_player_id', - // // 'ss_team_id', - // 'season', - // ], - // update: [ - // 'total_events', - // 'total_min', - // 'average_min', - // 'events_played_home', - // 'events_played_away', - // 'minutes_played_home', - // 'minutes_played_away', - // 'goals', - // 'fouls', - // 'offsides', - // 'shots_on_target', - // 'shots_off_target', - // 'shots_blocked', - // 'total_shots', - // 'cards', - // ] - // ); - // } } private function array_template(array &$collection, int $ss_player_id, string $season) { $collection[$season][$ss_player_id]['ss_player_id'] = 0; - $collection[$season][$ss_player_id]['ss_team_id'] = 0; $collection[$season][$ss_player_id]['season'] = ''; $collection[$season][$ss_player_id]['total_events'] = 0; $collection[$season][$ss_player_id]['total_min'] = 0; diff --git a/config/queue.php b/config/queue.php index 116bd8d0..dda8d9c5 100644 --- a/config/queue.php +++ b/config/queue.php @@ -31,7 +31,7 @@ return [ 'connections' => [ 'sync' => [ - 'driver' => 'sync', + 'default' => env('QUEUE_CONNECTION', 'database'), ], 'database' => [ diff --git a/resources/views/mail/simple.blade.php b/resources/views/mail/simple.blade.php index 65f19877..8dfd6fa6 100644 --- a/resources/views/mail/simple.blade.php +++ b/resources/views/mail/simple.blade.php @@ -8,7 +8,6 @@

{{ $title }}

{{ $body }}

-

All is good!