You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

53 lines
1.1 KiB

<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithTitle;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithMapping;
class ExampleExport implements FromArray, WithHeadings, WithTitle, ShouldAutoSize,/* WithColumnFormatting,*/ WithMapping
{
protected $rows;
public function __construct(array $rows)
{
$this->rows = $rows;
}
public function map($row): array
{
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
}
public function headings(): array
{
return [
'Part Name',
'Part Description',
'Topic Name',
'Topic Description',
'Question Content',
'Question Description',
'Question Level',
'Question Type',
'Question Choice Content',
];
}
public function array(): array
{
return $this->rows;
}
public function title(): string
{
return 'Example';
}
public function columnFormats(): array
{
return [];
}
}