fileName = '联卡蝠激活卡' . date('YmdHis') . '.csv'; $this->users = User::pluck('username', 'id')->toArray(); } protected $headings = ['卡序号', '归属', '卡号', '打印卡号', '卡密', '类型', '专项', '状态', '激活用户', '激活时间', '创建时间', '更改时间']; public function map($info): array { $data = [ $info->id, $this->users[$info->user_id] ?? '无', '`' . $info->code, $info->type . $info->code, $info->pass, $info->type, $info->type == 'K' ? '商品ID:' . $info->source['goods'] . ';规格ID:' . $info->source['param'] : '非专项', $info->status_text, $this->users[$info->active_id] ?? '无', $info->actived_at, $info->created_at, $info->updated_at, ]; return $data; } }