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.
47 lines
1.5 KiB
47 lines
1.5 KiB
<?php
|
|
|
|
namespace App\Exports;
|
|
|
|
use App\Models\Paramedic;
|
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
|
|
class ParamedicExport implements FromCollection
|
|
{
|
|
/**
|
|
* @return \Illuminate\Support\Collection
|
|
*/
|
|
public function collection()
|
|
{
|
|
$paramedics = Paramedic::all();
|
|
$res = [];
|
|
foreach ($paramedics as $paramedic) {
|
|
$res[] = [
|
|
"编号" => $paramedic->serial,
|
|
"姓名" => $paramedic->name,
|
|
"性别" => $paramedic->sex,
|
|
"手机" => $paramedic->mobile." ",
|
|
"身份证号" => $paramedic->id_card_number." ",
|
|
"生日" => $paramedic->birthday,
|
|
"籍贯" => $paramedic->hometown,
|
|
"身份证住址" => $paramedic->hometown_address,
|
|
"现住址" => $paramedic->address,
|
|
"紧急联系电话" => $paramedic->emergency_phone,
|
|
"工作年限" => $paramedic->work_years,
|
|
"所在项目" => "",
|
|
"护工等级" => "",
|
|
"入职时间" => $paramedic->join_at,
|
|
"照片" => "",
|
|
"身份证头像面" => $paramedic->idcard_front,
|
|
"身份证国徽面" => $paramedic->idcard_back,
|
|
"健康证" => $paramedic->health_certificate,
|
|
"执业资格证" => $paramedic->work_certificate
|
|
];
|
|
}
|
|
|
|
if (count($res)) {
|
|
array_unshift($res,array_keys($res[0]));
|
|
}
|
|
return collect($res);
|
|
}
|
|
}
|