'applications',
'applications.user',
'description',
- 'participants',
- 'participants.user',
]);
+ $participants = $tournament->participants()
+ ->where(function ($query) use ($request, $tournament) {
+ $query->where('placement', '<=', $tournament->limit_scoreboard);
+ $query->orWhereJsonContains('roles', 'admin');
+ $query->orWhereJsonContains('roles', 'monitor');
+ if ($request->user()) {
+ $query->orWhere('user_id', '=', $request->user()->id);
+ }
+ })
+ ->with(['user'])
+ ->get();
$rounds = $tournament->rounds()
->with(['results', 'results.user', 'results.verified_by'])
->limit($tournament->ceilRoundLimit(25))
}
}
$json = $tournament->toArray();
+ $json['participants'] = $participants->toArray();
$json['rounds'] = $rounds->toArray();
if ($request->user()) {
$json['group_assignments'] = GroupAssignment::query()