123456789101112131415161718192021222324252627 |
- <?php
- namespace App\Exports;
- use Maatwebsite\Excel\Concerns\WithMultipleSheets;
- class MultiSheetExport implements WithMultipleSheets
- {
- protected $data;
- public function __construct(array $data)
- {
- $this->data = $data;
- }
- public function sheets(): array
- {
- $sheets = [];
- foreach ($this->data as $sheetName => $sheetData) {
- $sheets[] = new SingleSheetExport($sheetData, $sheetName);
- }
- return $sheets;
- }
- }
|