uawdijnntqw1x1x1
IP : 216.73.216.130
Hostname : it-staging-server
Kernel : Linux it-staging-server 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
forge
/
stage.herta-bht.smartcon-survey.com
/
app
/
Exports
/
KPITimeLineExport.php
/
/
<?php namespace App\Exports; use App\Models\Brand; use App\Models\Country; use App\Models\Product; use Maatwebsite\Excel\Concerns\FromArray; use Maatwebsite\Excel\Concerns\WithHeadings; class KPITimeLineExport implements FromArray, WithHeadings { private array $data; private Country $country; private Brand|Product $brand; public function __construct(array $data, Country $country, Brand|Product $brand) { $this->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); } }
/home/forge/stage.herta-bht.smartcon-survey.com/app/Exports/KPITimeLineExport.php