We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 567b4ba commit 10a711dCopy full SHA for 10a711d
app/Http/Controllers/Api/PlanetStatusController.php
@@ -97,13 +97,17 @@ public function playersGlobal(Request $request) {
97
98
if (!$request->has('time')) {
99
$time = Carbon::now();
100
+ error_log($time);
101
} else {
102
$time = Carbon::parse($data['time']);
103
104
}
105
- $players = Planet::with(['history' => function (Builder $q) use ($time) {
106
+ $planets = Planet::with(['history' => function (Builder $q) use ($time) {
107
$q->latest()->where('created_at', '<', $time)->limit(1);
- }])->sum('players');
108
+ }])->get();
109
+
110
+ $players = $planets->pluck('history')->OneEntryArrayList()->sum('players');
111
112
return response()->json([
113
"count" => $players
0 commit comments