Skip to content

Commit

Permalink
fix(SimilarGames): block adding games from ConsoleID 100 (#3193)
Browse files Browse the repository at this point in the history
  • Loading branch information
wescopeland authored Feb 7, 2025
1 parent b99e37e commit e75432b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Filament/Resources/GameResource/Pages/SimilarGames.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ public function table(Table $table): Table
->multiple()
->options(function () {
return Game::whereNot('ID', $this->getOwnerRecord()->id)
->where('ConsoleID', '!=', System::Hubs)
->limit(50)
->with('system')
->get()
->mapWithKeys(fn ($game) => [$game->id => "[{$game->id}] {$game->title} ({$game->system->name})"]);
})
->getOptionLabelsUsing(function (array $values): array {
return Game::whereIn('ID', $values)
->where('ConsoleID', '!=', System::Hubs)
->with('system')
->get()
->mapWithKeys(fn ($game) => [$game->id => "[{$game->id}] {$game->title} ({$game->system->name})"])
Expand All @@ -113,6 +115,7 @@ public function table(Table $table): Table
->searchable()
->getSearchResultsUsing(function (string $search) {
return Game::whereNot('ID', $this->getOwnerRecord()->id)
->where('ConsoleID', '!=', System::Hubs)
->where(function ($query) use ($search) {
$query->where('ID', 'LIKE', "%{$search}%")
->orWhere('Title', 'LIKE', "%{$search}%");
Expand Down

0 comments on commit e75432b

Please sign in to comment.