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.sksb.smartcon-survey.com
/
app
/
Services
/
..
/
Helpers
/
ExcelHelper.php
/
/
<?php namespace App\Helpers; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use Symfony\Component\HttpFoundation\StreamedResponse; class ExcelHelper { private Spreadsheet $spreadsheet; private int $activeSheetIndex; public function __construct() { $this->spreadsheet = new Spreadsheet; $this->activeSheetIndex = $this->spreadsheet->getActiveSheetIndex(); } /** * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function addSheet(string $title, array $content): void { if ($this->activeSheetIndex > 0) { $this->spreadsheet->createSheet(); $this->spreadsheet->setActiveSheetIndex($this->activeSheetIndex); } $this->spreadsheet->getActiveSheet()->setTitle($title); $this->spreadsheet->getActiveSheet()->fromArray($content); $this->activeSheetIndex++; } /** * @throws \PhpOffice\PhpSpreadsheet\Exception */ public function addSheets(array $data): void { foreach ($data as $name => $sheet) { $this->addSheet($name, $sheet); } } public function download(string $fileName): StreamedResponse { return response()->streamDownload(function () use ($fileName) { $fileType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; ob_clean(); header('Content-Description: File Transfer'); header('Content-Type: '.$fileType); header('Content-disposition: attachment; filename='.$fileName.' Daten.xlsx'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); $writer = new Xlsx($this->spreadsheet); $writer->save('php://output'); }, $fileName.'.xlsx'); } }
/home/forge/stage.sksb.smartcon-survey.com/app/Services/../Helpers/ExcelHelper.php