|
|
@@ -33,7 +33,7 @@ class ItemController extends AdminController
|
|
|
*/
|
|
|
protected function grid()
|
|
|
{
|
|
|
- return Grid::make(new ItemRepository(), function (Grid $grid) {
|
|
|
+ return Grid::make(new ItemRepository(['category']), function (Grid $grid) {
|
|
|
$helper = new GridHelper($grid, $this);
|
|
|
$grid->column('id', 'ID')->sortable();
|
|
|
$grid->column('name', '名称');
|
|
|
@@ -48,6 +48,11 @@ class ItemController extends AdminController
|
|
|
$grid->column('created_at', '创建时间');
|
|
|
$grid->column('updated_at', '更新时间');
|
|
|
|
|
|
+ // 添加复制行操作
|
|
|
+ $grid->actions(function (Grid\Displayers\Actions $actions) {
|
|
|
+ $actions->append(new \App\Module\GameItems\AdminControllers\Actions\DuplicateRowAction());
|
|
|
+ });
|
|
|
+
|
|
|
// 筛选
|
|
|
$grid->filter(function ($filter) {
|
|
|
$helper = new FilterHelper($filter, $this);
|
|
|
@@ -77,8 +82,8 @@ class ItemController extends AdminController
|
|
|
});
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
/**
|
|
|
* 详情页
|
|
|
*
|
|
|
@@ -113,7 +118,7 @@ class ItemController extends AdminController
|
|
|
$show->field('updated_at', '更新时间');
|
|
|
|
|
|
// 如果是宝箱类型,显示宝箱内容
|
|
|
- if ($show->getModel()->type == ITEM_TYPE::OPENABLE) {
|
|
|
+ if ($show->getModel()->type == ITEM_TYPE::CHEST) {
|
|
|
$show->chestContents('宝箱内容', function ($chestContents) {
|
|
|
$chestContents->resource('/admin/game-items-chest-contents');
|
|
|
$chestContents->id('ID');
|
|
|
@@ -177,7 +182,7 @@ class ItemController extends AdminController
|
|
|
// 保存前回调
|
|
|
$form->saving(function (Form $form) {
|
|
|
// 如果是宝箱类型,确保有min_drop_count和max_drop_count属性
|
|
|
- if ($form->type == ITEM_TYPE::OPENABLE) {
|
|
|
+ if ($form->type == ITEM_TYPE::CHEST) {
|
|
|
$numericAttributes = $form->numeric_attributes ?: [];
|
|
|
if (!isset($numericAttributes['min_drop_count'])) {
|
|
|
$numericAttributes['min_drop_count'] = 1;
|