data; $format = Config::get('firefly.month.' . $language); $data = [ 'count' => 1, 'labels' => [], 'datasets' => [ [ 'label' => 'Diff', 'data' => [] ] ], ]; $sum = '0'; bcscale(2); foreach ($set as $entry) { $date = new Carbon($entry->date); $sum = bcadd($sum, $entry->sum); $data['labels'][] = $date->formatLocalized($format); $data['datasets'][0]['data'][] = round($sum, 2); } return $data; } }