|
|
@@ -66,8 +66,12 @@ class FarmLandUpgradeConfigController extends AdminController
|
|
|
]);
|
|
|
|
|
|
$helper->columnId();
|
|
|
- $grid->column('from_type_id', '起始土地类型ID')->sortable();
|
|
|
- $grid->column('to_type_id', '目标土地类型ID')->sortable();
|
|
|
+ $grid->column('from_type_id', '起始土地类型')->display(function ($fromTypeId) {
|
|
|
+ return $this->fromType ? $this->fromType->name : "未知类型 (ID: {$fromTypeId})";
|
|
|
+ })->sortable();
|
|
|
+ $grid->column('to_type_id', '目标土地类型')->display(function ($toTypeId) {
|
|
|
+ return $this->toType ? $this->toType->name : "未知类型 (ID: {$toTypeId})";
|
|
|
+ })->sortable();
|
|
|
$grid->column('materials', '消耗组')->display(function ($materialsGroupId) {
|
|
|
if (!$materialsGroupId) {
|
|
|
return '<span class="text-muted">使用 materials 字段</span>';
|
|
|
@@ -108,19 +112,26 @@ class FarmLandUpgradeConfigController extends AdminController
|
|
|
$helper = new ShowHelper($show, $this);
|
|
|
|
|
|
$show->field('id', 'ID');
|
|
|
- $show->field('from_type_id', '起始土地类型ID');
|
|
|
- $show->field('to_type_id', '目标土地类型ID');
|
|
|
- $show->field('material', '消耗组')->as(function ($materialsGroupId) {
|
|
|
-
|
|
|
+ $show->field('from_type_id', '起始土地类型')->as(function ($fromTypeId) {
|
|
|
+ return $this->fromType ? "{$this->fromType->name} (ID: {$fromTypeId})" : "未知类型 (ID: {$fromTypeId})";
|
|
|
+ });
|
|
|
+ $show->field('to_type_id', '目标土地类型')->as(function ($toTypeId) {
|
|
|
+ return $this->toType ? "{$this->toType->name} (ID: {$toTypeId})" : "未知类型 (ID: {$toTypeId})";
|
|
|
+ });
|
|
|
+ $show->field('materials', '消耗组')->as(function ($materialsGroupId) {
|
|
|
+ if (!$materialsGroupId) {
|
|
|
+ return '<span class="text-muted">使用 materials 字段</span>';
|
|
|
+ }
|
|
|
$consumeGroup = GameConsumeGroup::find($materialsGroupId);
|
|
|
return $consumeGroup ? "{$consumeGroup->name} ({$consumeGroup->code})" : "未知 ({$materialsGroupId})";
|
|
|
});
|
|
|
$show->field('conditions', '条件组')->as(function ($conditionsGroupId) {
|
|
|
+ if (!$conditionsGroupId) {
|
|
|
+ return '<span class="text-muted">使用 conditions 字段</span>';
|
|
|
+ }
|
|
|
$conditionGroup = GameConditionGroup::find($conditionsGroupId);
|
|
|
return $conditionGroup ? "{$conditionGroup->name} ({$conditionGroup->code})" : "未知 ({$conditionsGroupId})";
|
|
|
});
|
|
|
- $helper->fieldModelCatsJson('materials', '升级所需材料(已废弃)');
|
|
|
- $helper->fieldModelCatsJson('conditions', '其他升级条件');
|
|
|
$show->field('created_at', '创建时间');
|
|
|
$show->field('updated_at', '更新时间');
|
|
|
});
|
|
|
@@ -138,8 +149,8 @@ class FarmLandUpgradeConfigController extends AdminController
|
|
|
|
|
|
$form->display('id', 'ID');
|
|
|
|
|
|
- $helper->selectModelOption('from_type_id', '起始土地类型ID', FarmLandType::class, 'name', 'id');
|
|
|
- $helper->selectModelOption('to_type_id', '目标土地类型ID', FarmLandType::class, 'name', 'id');
|
|
|
+ $helper->selectModelOption('from_type_id', '起始土地类型', FarmLandType::class, 'name', 'id');
|
|
|
+ $helper->selectModelOption('to_type_id', '目标土地类型', FarmLandType::class, 'name', 'id');
|
|
|
|
|
|
// 添加消耗组选择(使用表格选择器)
|
|
|
$consumeGroupTable = GameConsumeGroupLazyRenderable::make();
|