rsabhk_hsr/app/Exports/RegistrasiExport.php
2025-04-27 20:42:42 +07:00

34 lines
746 B
PHP

<?php
namespace App\Exports;
use App\Models\Registrasi;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithStyles;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class RegistrasiExport implements FromCollection, WithStyles, ShouldAutoSize
{
protected $header;
protected $data;
public function __construct(array $header, array $data)
{
$this->header = $header;
$this->data = $data;
}
public function collection()
{
return collect([$this->header])->merge($this->data);
}
public function styles(Worksheet $sheet)
{
return [
1 => ['font' => ['bold' => true]],
];
}
}