payload['id'] ?? 0; $builder = DealerEarning::query(); // dd($userId); $builder->with(['user', 'payer'])->where(function ($q) use ($userId) { return $q->where('user_id', $userId)->orWhere('payer_id', $userId); }); return Grid::make($builder, function (Grid $grid) { $grid->column('user.phone', '收款人'); $grid->column('payer_id', '付款人')->display(function () { return $this->payer_id ? $this->payer?->phone : '公司'; }); $grid->column('earningable_type', '资金类型')->display(function () { return $this->earningable_type_text; })->label([ (new DealerManageSubsidy())->getMorphClass() => 'primary', (new DealerManagerSubsidy())->getMorphClass() => 'success', (new DealerPurchaseSubsidy())->getMorphClass() => 'danger', (new DealerChannelSubsidyLog())->getMorphClass() => 'warning', ])->filter(Grid\Column\Filter\In::make([ (new DealerManagerSubsidy())->getMorphClass() =>'管理者补贴', (new DealerManageSubsidy())->getMorphClass() => '管理补贴', (new DealerChannelSubsidyLog())->getMorphClass() => '渠道补贴', (new DealerPurchaseSubsidy())->getMorphClass() => '进货补贴', ])); $grid->column('remark', '备注')->display('详情') // 设置按钮名称 ->expand(function () { // 这里返回 content 字段内容,并用 Card 包裹起来 $card = new Card(null, $this->remark); return "