Files
pingan_new/app/Admin/Exporters/UsersExport.php
2020-08-06 16:42:18 +08:00

37 lines
1.0 KiB
PHP

<?php
namespace App\Admin\Exporters;
use Encore\Admin\Grid\Exporters\ExcelExporter;
use Maatwebsite\Excel\Concerns\WithMapping;
class UsersExport extends ExcelExporter implements WithMapping
{
protected $headings = ['登录账户', '渠道编号', '网点编号', '平安网点id', '所属项目', '服务秘钥', 'DES3秘钥', '渠道/网点', '用户身份', '隶属渠道', '注册时间'];
public function __construct()
{
$this->fileName = '用户列表' . date('YmdHis') . '.xlsx';
}
public function map($info): array
{
$data = [
$info->username,
' ' . $info->server_id ?? $info->parent->server_id,
' ' . $info->outlet_id ?? '---',
' ' . $info->PaOutletId ?? '---',
$info->type_text,
$info->server_key ?? '---',
$info->des3key ?? '---',
$info->nickname,
$info->identity_text,
$info->parent ? $info->parent->nickname : '---',
$info->created_at,
];
return $data;
}
}