config['parameters'], $params); $response = LambdaRequest::signedrequest('post', 'metric', 'metric_report/view', $params ); $colors = ['FECD00', '01C14B', 'FF8050', '4A5CD0', '707070']; $dates = []; foreach($response->data->graph->values as $value) { $value->table = []; foreach($value->stats as $stat) { $value->table[$stat->x] = $stat->y; $dates[] = $stat->x; } } usort($dates, function($a, $b) { return strtotime($a) - strtotime($b); }); $dates = array_unique($dates); $tabledata = []; foreach($response->data->graph->values as $value) { $tabledata[$value->hierarchy_id]['name'] = $value->user->name; foreach ($dates as $date) { $tabledata[$value->hierarchy_id]['values'][$date] = array_key_exists($date, $value->table) ? $value->table[$date] : ''; } } return view('widgets.team_trend_monthly', ['title' => $this->config['title'], 'tabledata' => $tabledata, 'dates' => $dates]); } }