123456789101112131415161718192021222324252627282930 |
- <?php
- namespace App\Exports;
- use Maatwebsite\Excel\Concerns\FromCollection;
- use Maatwebsite\Excel\Concerns\WithTitle;
- use Illuminate\Support\Collection;
- class SingleSheetExport implements FromCollection,WithTitle
- {
- protected $data;
- protected $sheetName;
- public function __construct(array $data, string $sheetName)
- {
- $this->data = $data;
- $this->sheetName = $sheetName;
- }
- public function collection()
- {
- return new Collection($this->data);
- }
- public function title(): string
- {
- return $this->sheetName;
- }
- }
|