I'm trying to get this field from my mongodb, but i don't know why i get stored in my var only the first value (that isn't the highest) and the correct one. Can someone please help me?
public function globalChartGet() {
$firstInChart = 0;
$users = User::all();
foreach ($users as $user) {
if ($user->points > $firstInChart) {
$firstInChart = $user->points;
}
}
}
via McMazalf