初始化项目

This commit is contained in:
molong committed 2026-02-08 22:38:13 +08:00
commit 334d2c6312
201 files changed
+32724

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App\Exports;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
class GenericExport implements FromCollection, WithHeadings
{
protected $data;
public function __construct(array $data)
{
$this->data = $data;
}
/**
* 获取数据集合
*/
public function collection()
{
return collect($this->data);
}
/**
* 设置表头
*/
public function headings(): array
{
// 第一行作为表头
return $this->data[0] ?? [];
}
}