1
0
Files
lkafu/app/Admin/Exporters/CashOutExport.php
2020-08-06 14:45:56 +08:00

40 lines
1.2 KiB
PHP

<?php
namespace App\Admin\Exporters;
use Encore\Admin\Grid\Exporters\ExcelExporter;
use Maatwebsite\Excel\Concerns\WithMapping;
class CashOutExport extends ExcelExporter implements WithMapping
{
protected $fileName = '提现用户.xlsx';
protected $columns = [
'id' => '序号',
'user_id' => '用户ID',
'user.username' => '用户账号',
'user.info.nickname' => '用户昵称',
'cash_account_no' => '支付宝账户',
'variable' => '提现金额',
'state' => '提现状态',
'created_at' => '提现时间',
];
public function map($info): array
{
$data = [
'id' => $info->id,
'user_id' => $info->user_id,
'user.username' => ' ' . $info->user->username,
'user.info.nickname' => ' ' . $info->user->info->nickname,
'cash_account_no' => ' ' . $info->cash_account_no,
'variable' => ' ' . $info->variable,
'state' => $info->state_text,
'created_at' => $info->created_at,
];
return $data;
}
}