46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Exports;
|
||
|
|
|
||
|
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||
|
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||
|
|
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||
|
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||
|
|
use Maatwebsite\Excel\Concerns\WithStrictNullComparison;
|
||
|
|
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||
|
|
|
||
|
|
class ActivityMemberExportV2 implements FromCollection ,WithHeadings,WithStrictNullComparison,WithColumnFormatting,ShouldAutoSize
|
||
|
|
{
|
||
|
|
private $data;
|
||
|
|
public function __construct($data)
|
||
|
|
{
|
||
|
|
$this->data = $data;
|
||
|
|
}
|
||
|
|
public function headings(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'姓名',
|
||
|
|
"真实姓名",
|
||
|
|
'手机号',
|
||
|
|
'是否认证',
|
||
|
|
'性别',
|
||
|
|
'编号',
|
||
|
|
'參保信息',
|
||
|
|
'机构'
|
||
|
|
|
||
|
|
];
|
||
|
|
}
|
||
|
|
//设置列格式
|
||
|
|
public function columnFormats(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'A' => NumberFormat::FORMAT_TEXT,
|
||
|
|
];
|
||
|
|
}
|
||
|
|
public function collection()
|
||
|
|
{
|
||
|
|
$data = collect($this->data);
|
||
|
|
return $data;
|
||
|
|
}
|
||
|
|
}
|