Files
GSB-Construction/Modules/MasterData/app/Exports/MaterialTemplateExport.php

38 lines
1.1 KiB
PHP

<?php
namespace Modules\MasterData\Exports;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class MaterialTemplateExport implements FromArray, WithHeadings, WithStyles
{
public function headings(): array
{
return ['Name', 'SKU', 'Category', 'Unit', 'Unit Cost', 'Description', 'Group'];
}
public function array(): array
{
return [
['Portland Cement Type I', 'CEM-001', 'cement', 'bag', '280.00', '50kg bag', 'Foundation Materials'],
['Deformed Steel Bar 16mm', 'STL-016', 'steel', 'pcs', '450.00', '6m length', 'Structural Materials'],
];
}
public function styles(Worksheet $sheet): array
{
return [
1 => [
'font' => ['bold' => true],
'fill' => [
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'startColor' => ['argb' => 'FFE8E8E8'],
],
],
];
}
}