ProjectExcel.php
824 Bytes
<?php
namespace App\Excel;
use App\Support\ExcelExport;
class ProjectExcel extends ExcelExport
{
protected function beforeHandle(): void
{
$this->builder->with('master:id,nick_name');
$this->setHeader(["厂牌名称", '主理人', "厂牌管理员人数", "厂牌成员人数", "上架歌曲数", "已匹配歌曲数", '已发行歌曲数']);
$this->setColumns(['A:B' => 32, 'C:I' => 24]);
}
protected function setData($item): array
{
return [
$item->name,
$item->getRelation('master')?->getAttribute('nick_name'),
$item->manage_count ?? 0,
$item->member_count ?? 0,
$item->activity_up_count ?? 0,
$item->activity_match_count ?? 0,
$item->activity_send_count ?? 0,
];
}
}