diff --git a/app/Actions/LoadStatisticFixturesMatchOptions.php b/app/Actions/LoadStatisticFixturesMatchOptions.php index 4df9bcc4..5ad8d769 100644 --- a/app/Actions/LoadStatisticFixturesMatchOptions.php +++ b/app/Actions/LoadStatisticFixturesMatchOptions.php @@ -2,6 +2,7 @@ namespace App\Actions; +use App\Models\SofaScoreRosa; use App\Models\StatisticFixtures; class LoadStatisticFixturesMatchOptions @@ -11,11 +12,13 @@ class LoadStatisticFixturesMatchOptions if (! $league_id) { return []; } + $team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray(); + $res = StatisticFixtures::where('league_id', $league_id)->get(); $arr = []; foreach ($res as $val) { - $arr[$val->id] = $val->starttime->format('Y-m-d H:i') . ' - ' . $val->home->ss_team_name . ' vs ' . $val->away->ss_team_name; + $arr[$val->id] = $val->starttime->format('Y-m-d H:i').' - '.$team_map[$val->home_id].' vs '.$team_map[$val->away_id]; } return $arr; diff --git a/app/Filament/Pages/Selections/LoadPlayerSelection.php b/app/Filament/Pages/Selections/LoadPlayerSelection.php index dcad23bb..9c1c1379 100644 --- a/app/Filament/Pages/Selections/LoadPlayerSelection.php +++ b/app/Filament/Pages/Selections/LoadPlayerSelection.php @@ -37,6 +37,8 @@ class LoadPlayerSelection $player = SofaScorePlayerPerSeason::with('details')->where('ss_team_id', $team_id)->whereIn('season', $season)->get(); + // dd($player); + $arr = []; foreach ($player as $val) { if ($val->details) { diff --git a/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQuery.php b/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQuery.php index d42e8a6a..d9aa8441 100644 --- a/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQuery.php +++ b/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQuery.php @@ -3,6 +3,7 @@ namespace App\Filament\Widgets\Charts\LoadEvents; use App\Filament\Pages\Selections\Helper\GetSeason; +use App\Models\SofaScoreRosa; use App\Models\StatistikoEvent; use App\Models\StatistikoPlayer; use Illuminate\Support\Facades\Log; @@ -87,19 +88,20 @@ class LoadEventsQuery } } + $team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray(); + // dd($handicap_range, $total_range); /** * STATTISTIC DATA */ // dd($team_id, $home_id, $away_id); - $res = StatistikoEvent::with('home')->with('away') - ->where(function ($query) use ($league_id, $similar_past_matches) { - switch ($similar_past_matches) { - case 'none': - case 'league': - return $query->where('league_id', $league_id); - } - }) + $res = StatistikoEvent::where(function ($query) use ($league_id, $similar_past_matches) { + switch ($similar_past_matches) { + case 'none': + case 'league': + return $query->where('league_id', $league_id); + } + }) ->where(function ($query) use ($team_id, $home_id, $away_id, $similar_past_matches) { if ($similar_past_matches == 'none') { if ($team_id) { @@ -155,8 +157,8 @@ class LoadEventsQuery $tmp['exp_handicap'] = $value->exp_handicap; $tmp['exp_total'] = $value->exp_total; $tmp['result_code'] = $value->result_code; - $tmp['home'] = $value->home->ss_team_name ?? 0; - $tmp['away'] = $value->away->ss_team_name ?? 0; + $tmp['home'] = $team_map[$value->home_id] ?? 0; + $tmp['away'] = $team_map[$value->away_id] ?? 0; switch ($statistic_type) { case 'gls': diff --git a/app/Filament/Widgets/Charts/LoadPerformance.php b/app/Filament/Widgets/Charts/LoadPerformance.php index 8df44af7..7a238f96 100644 --- a/app/Filament/Widgets/Charts/LoadPerformance.php +++ b/app/Filament/Widgets/Charts/LoadPerformance.php @@ -2,6 +2,7 @@ namespace App\Filament\Widgets\Charts; +use App\Models\SofaScoreRosa; use App\Models\StatisticFixtures; use App\Models\StatistikoEvent; use App\Models\StatistikoPlayer; @@ -22,8 +23,6 @@ class LoadPerformance $team_position = $filter['team_position']; - $team_id = (int) $filter['team_id'] ?? 0; - if (! $league_id) { return []; } @@ -31,18 +30,15 @@ class LoadPerformance return []; } - $match = StatisticFixtures::with('home')->with('away')->where('id', $match_id)->first(); + $team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray(); + $match = StatisticFixtures::where('id', $match_id)->first(); if (! $match) { return []; } - $home_id = $match->home_id ?? 0; $away_id = $match->away_id ?? 0; - // $labels[] = round($value['starttime']->diffInDays(Carbon::now())); - // $playing_date[] = $value['starttime']->format('Y-m-d H:i'); - $res = StatistikoEvent::where('league_id', $league_id)->get(); $home_matches = []; @@ -63,14 +59,14 @@ class LoadPerformance $labels[] = round($val->starttime->diffInDays(Carbon::now())); $date_home[] = $val['starttime']->format('Y-m-d H:i'); $results_home[] = $val['gls_h'].' : '.$val['gls_a']; - $events_home[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name; + $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id]; $home_matches[] = $val->match_id; } if ($val->away_id == $away_id) { $labels[] = round($val->starttime->diffInDays(Carbon::now())); $date_away[] = $val['starttime']->format('Y-m-d H:i'); $results_away[] = $val['gls_h'].' : '.$val['gls_a']; - $events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name; + $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id]; $away_matches[] = $val->match_id; } break; @@ -79,14 +75,14 @@ class LoadPerformance $labels[] = round($val->starttime->diffInDays(Carbon::now())); $date_home[] = $val['starttime']->format('Y-m-d H:i'); $results_home[] = $val['gls_h'].' : '.$val['gls_a']; - $events_home[] = $val->home->name.' vs '.$val->away->name; + $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id]; $home_matches[] = $val->match_id; } if ($val->home_id == $away_id) { $labels[] = round($val->starttime->diffInDays(Carbon::now())); $date_away[] = $val['starttime']->format('Y-m-d H:i'); $results_away[] = $val['gls_h'].' : '.$val['gls_a']; - $events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name; + $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id]; $away_matches[] = $val->match_id; } break; @@ -95,14 +91,14 @@ class LoadPerformance $labels[] = round($val->starttime->diffInDays(Carbon::now())); $date_home[] = $val['starttime']->format('Y-m-d H:i'); $results_home[] = $val['gls_h'].' : '.$val['gls_a']; - $events_home[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name; + $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id]; $home_matches[] = $val->match_id; } if ($val->home_id == $away_id or $val->away_id == $away_id) { $labels[] = round($val->starttime->diffInDays(Carbon::now())); $date_away[] = $val['starttime']->format('Y-m-d H:i'); $results_away[] = $val['gls_h'].' : '.$val['gls_a']; - $events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name; + $events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id]; $away_matches[] = $val->match_id; } break; @@ -135,7 +131,7 @@ class LoadPerformance $data = [ 'datasets' => [ [ - 'label' => $match->home->ss_team_name, + 'label' => $team_map[$match->home_id], 'playing_date' => $date_home, 'results_per_event' => $results_home, 'events' => $events_home, @@ -246,7 +242,7 @@ class LoadPerformance 'hidden' => true, ], [ - 'label' => $match->away->ss_team_name, + 'label' => $team_map[$match->away_id], 'playing_date' => $date_away, 'results_per_event' => $results_away, 'events' => $events_away, diff --git a/app/Providers/TelescopeServiceProvider.php b/app/Providers/TelescopeServiceProvider.php new file mode 100644 index 00000000..4de2a6b2 --- /dev/null +++ b/app/Providers/TelescopeServiceProvider.php @@ -0,0 +1,65 @@ +hideSensitiveRequestDetails(); + + $isLocal = $this->app->environment('local'); + + Telescope::filter(function (IncomingEntry $entry) use ($isLocal) { + return $isLocal || + $entry->isReportableException() || + $entry->isFailedRequest() || + $entry->isFailedJob() || + $entry->isScheduledTask() || + $entry->hasMonitoredTag(); + }); + } + + /** + * Prevent sensitive request details from being logged by Telescope. + */ + protected function hideSensitiveRequestDetails(): void + { + if ($this->app->environment('local')) { + return; + } + + Telescope::hideRequestParameters(['_token']); + + Telescope::hideRequestHeaders([ + 'cookie', + 'x-csrf-token', + 'x-xsrf-token', + ]); + } + + /** + * Register the Telescope gate. + * + * This gate determines who can access Telescope in non-local environments. + */ + protected function gate(): void + { + Gate::define('viewTelescope', function (User $user) { + return in_array($user->email, [ + // + ]); + }); + } +} diff --git a/bootstrap/providers.php b/bootstrap/providers.php index ec5248a7..891ff090 100644 --- a/bootstrap/providers.php +++ b/bootstrap/providers.php @@ -1,9 +1,7 @@ env('TELESCOPE_ENABLED', true), + + /* + |-------------------------------------------------------------------------- + | Telescope Domain + |-------------------------------------------------------------------------- + | + | This is the subdomain where Telescope will be accessible from. If the + | setting is null, Telescope will reside under the same domain as the + | application. Otherwise, this value will be used as the subdomain. + | + */ + + 'domain' => env('TELESCOPE_DOMAIN'), + + /* + |-------------------------------------------------------------------------- + | Telescope Path + |-------------------------------------------------------------------------- + | + | This is the URI path where Telescope will be accessible from. Feel free + | to change this path to anything you like. Note that the URI will not + | affect the paths of its internal API that aren't exposed to users. + | + */ + + 'path' => env('TELESCOPE_PATH', 'telescope'), + + /* + |-------------------------------------------------------------------------- + | Telescope Storage Driver + |-------------------------------------------------------------------------- + | + | This configuration options determines the storage driver that will + | be used to store Telescope's data. In addition, you may set any + | custom options as needed by the particular driver you choose. + | + */ + + 'driver' => env('TELESCOPE_DRIVER', 'database'), + + 'storage' => [ + 'database' => [ + 'connection' => env('DB_CONNECTION', 'mysql'), + 'chunk' => 1000, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Queue + |-------------------------------------------------------------------------- + | + | This configuration options determines the queue connection and queue + | which will be used to process ProcessPendingUpdate jobs. This can + | be changed if you would prefer to use a non-default connection. + | + */ + + 'queue' => [ + 'connection' => env('TELESCOPE_QUEUE_CONNECTION'), + 'queue' => env('TELESCOPE_QUEUE'), + 'delay' => env('TELESCOPE_QUEUE_DELAY', 10), + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Route Middleware + |-------------------------------------------------------------------------- + | + | These middleware will be assigned to every Telescope route, giving you + | the chance to add your own middleware to this list or change any of + | the existing middleware. Or, you can simply stick with this list. + | + */ + + 'middleware' => [ + 'web', + Authorize::class, + ], + + /* + |-------------------------------------------------------------------------- + | Allowed / Ignored Paths & Commands + |-------------------------------------------------------------------------- + | + | The following array lists the URI paths and Artisan commands that will + | not be watched by Telescope. In addition to this list, some Laravel + | commands, like migrations and queue commands, are always ignored. + | + */ + + 'only_paths' => [ + // 'api/*' + ], + + 'ignore_paths' => [ + 'livewire*', + 'nova-api*', + 'pulse*', + '_boost*', + '.well-known*', + ], + + 'ignore_commands' => [ + // + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Watchers + |-------------------------------------------------------------------------- + | + | The following array lists the "watchers" that will be registered with + | Telescope. The watchers gather the application's profile data when + | a request or task is executed. Feel free to customize this list. + | + */ + + 'watchers' => [ + Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true), + + Watchers\CacheWatcher::class => [ + 'enabled' => env('TELESCOPE_CACHE_WATCHER', true), + 'hidden' => [], + 'ignore' => [], + ], + + Watchers\ClientRequestWatcher::class => [ + 'enabled' => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true), + 'ignore_hosts' => [], + ], + + Watchers\CommandWatcher::class => [ + 'enabled' => env('TELESCOPE_COMMAND_WATCHER', true), + 'ignore' => [], + ], + + Watchers\DumpWatcher::class => [ + 'enabled' => env('TELESCOPE_DUMP_WATCHER', true), + 'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false), + ], + + Watchers\EventWatcher::class => [ + 'enabled' => env('TELESCOPE_EVENT_WATCHER', true), + 'ignore' => [], + ], + + Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true), + + Watchers\GateWatcher::class => [ + 'enabled' => env('TELESCOPE_GATE_WATCHER', true), + 'ignore_abilities' => [], + 'ignore_packages' => true, + 'ignore_paths' => [], + ], + + Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true), + + Watchers\LogWatcher::class => [ + 'enabled' => env('TELESCOPE_LOG_WATCHER', true), + 'level' => 'error', + ], + + Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true), + + Watchers\ModelWatcher::class => [ + 'enabled' => env('TELESCOPE_MODEL_WATCHER', true), + 'events' => ['eloquent.*'], + 'hydrations' => true, + ], + + Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true), + + Watchers\QueryWatcher::class => [ + 'enabled' => env('TELESCOPE_QUERY_WATCHER', true), + 'ignore_packages' => true, + 'ignore_paths' => [], + 'slow' => 100, + ], + + Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true), + + Watchers\RequestWatcher::class => [ + 'enabled' => env('TELESCOPE_REQUEST_WATCHER', true), + 'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64), + 'ignore_http_methods' => [], + 'ignore_status_codes' => [], + ], + + Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true), + Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true), + ], +]; diff --git a/database/migrations/2026_09_25_102424_create_telescope_entries_table.php b/database/migrations/2026_09_25_102424_create_telescope_entries_table.php new file mode 100644 index 00000000..031b6f47 --- /dev/null +++ b/database/migrations/2026_09_25_102424_create_telescope_entries_table.php @@ -0,0 +1,70 @@ +getConnection()); + + $schema->create('telescope_entries', function (Blueprint $table) { + $table->bigIncrements('sequence'); + $table->uuid('uuid'); + $table->uuid('batch_id'); + $table->string('family_hash')->nullable(); + $table->boolean('should_display_on_index')->default(true); + $table->string('type', 20); + $table->longText('content'); + $table->dateTime('created_at')->nullable(); + + $table->unique('uuid'); + $table->index('batch_id'); + $table->index('family_hash'); + $table->index('created_at'); + $table->index(['type', 'should_display_on_index']); + }); + + $schema->create('telescope_entries_tags', function (Blueprint $table) { + $table->uuid('entry_uuid'); + $table->string('tag'); + + $table->primary(['entry_uuid', 'tag']); + $table->index('tag'); + + $table->foreign('entry_uuid') + ->references('uuid') + ->on('telescope_entries') + ->cascadeOnDelete(); + }); + + $schema->create('telescope_monitoring', function (Blueprint $table) { + $table->string('tag')->primary(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + $schema = Schema::connection($this->getConnection()); + + $schema->dropIfExists('telescope_entries_tags'); + $schema->dropIfExists('telescope_entries'); + $schema->dropIfExists('telescope_monitoring'); + } +}; diff --git a/database/migrations/2026_09_25_102426_create_telescope_entries_table.php b/database/migrations/2026_09_25_102426_create_telescope_entries_table.php new file mode 100644 index 00000000..031b6f47 --- /dev/null +++ b/database/migrations/2026_09_25_102426_create_telescope_entries_table.php @@ -0,0 +1,70 @@ +getConnection()); + + $schema->create('telescope_entries', function (Blueprint $table) { + $table->bigIncrements('sequence'); + $table->uuid('uuid'); + $table->uuid('batch_id'); + $table->string('family_hash')->nullable(); + $table->boolean('should_display_on_index')->default(true); + $table->string('type', 20); + $table->longText('content'); + $table->dateTime('created_at')->nullable(); + + $table->unique('uuid'); + $table->index('batch_id'); + $table->index('family_hash'); + $table->index('created_at'); + $table->index(['type', 'should_display_on_index']); + }); + + $schema->create('telescope_entries_tags', function (Blueprint $table) { + $table->uuid('entry_uuid'); + $table->string('tag'); + + $table->primary(['entry_uuid', 'tag']); + $table->index('tag'); + + $table->foreign('entry_uuid') + ->references('uuid') + ->on('telescope_entries') + ->cascadeOnDelete(); + }); + + $schema->create('telescope_monitoring', function (Blueprint $table) { + $table->string('tag')->primary(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + $schema = Schema::connection($this->getConnection()); + + $schema->dropIfExists('telescope_entries_tags'); + $schema->dropIfExists('telescope_entries'); + $schema->dropIfExists('telescope_monitoring'); + } +};