ActivityReListRecordExcel.php
960 Bytes
<?php
namespace App\Excel;
use App\Support\ExcelExport;
class ActivityReListRecordExcel extends ExcelExport
{
protected function beforeHandle(): void
{
$this->builder->with(['activity:id,song_name', 'project:id,name', 'user:id,nick_name', 'broker:id,nick_name', 'operator:id,nick_name']);
$this->setHeader(['歌曲ID', '歌曲名', '歌曲厂牌', '原合作用户ID', '原合作用户', '经纪人', '经纪人分类', '操作人', '操作时间'], 'A1:I1');
$this->setColumns(['A:I' => 28]);
}
protected function setData($item): array
{
return [
$item->activity?->id,
$item->activity?->song_name,
$item->project?->name,
$item->user?->id,
$item->user?->nick_name,
$item->broker?->nick_name,
$item->broker_level ?? '无',
$item->operator?->nick_name,
(string)$item->created_at
];
}
}