Skip to content

Commit

Permalink
Add per-player filter criteria
Browse files Browse the repository at this point in the history
* Golden Eggs
* Power Eggs
* Special weapon

Part of #5
  • Loading branch information
yukidaruma committed Mar 14, 2020
1 parent 24fa9a3 commit 1830863
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/UseCases/IndexResultUsecase.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ function buildMax($column)
->whereIn('stage_id', explode(',', $value)),
];

if ($results->getModel() instanceof SalmonPlayerResult) {
$filters += [
'player_min_golden_egg' => buildMin('golden_eggs'),
'player_max_golden_egg' => buildMax('golden_eggs'),
'player_min_power_egg' => buildMin('power_eggs'),
'player_max_power_egg' => buildMax('power_eggs'),
'special' => buildWhere('special_id', '='),
];
}

foreach ($filters as $key => $filter) {
if (isset($query[$key])) {
$results = $filter($results, $query[$key]);
Expand Down

0 comments on commit 1830863

Please sign in to comment.