芝麻web文件管理V1.00
编辑当前文件:/home/forge/stage.herta-bht.smartcon-survey.com/app/Exports/KPITimeLineExport.php
data = $data['data']; $this->country = $country; $this->brand = $brand; } public function array(): array { $rows = []; foreach ($this->data['datasets'] as $dataset) { $row = [ 'Country' => $this->country->name, 'Brand' => $this->brand->name, 'KPI Time Course' => $dataset['label'], ]; foreach ($dataset['data'] as $waveValue) { $row[$waveValue['x']] = $waveValue['y']; $row[$waveValue['x'].' (n)'] = $waveValue['n']; } $rows[] = $row; } return $rows; } public function headings(): array { $headings = array_reduce($this->data['labels'], function ($crr, $wave) { $crr[] = $wave.' in %'; $crr[] = $wave.' (n)'; return $crr; }, []); return array_merge(['Country', 'Brand', 'KPI Time Course'], $headings); } }