| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace App\Module\GameItems\AdminControllers\Actions;
- use App\Module\GameItems\Models\ItemChestContent;
- use Illuminate\Http\Request;
- use UCore\DcatAdmin\RowActionHandler;
- /**
- * 查看宝箱详情
- *
- * 在宝箱内容管理行中添加查看宝箱详情的快捷操作
- */
- class ViewChestDetailAction extends RowActionHandler
- {
- /**
- * 操作按钮标题
- *
- * @var string
- */
- public $title = '宝箱详情';
- /**
- * 处理请求
- *
- * @param Request $request
- * @return mixed
- */
- public function handle(Request $request)
- {
- $id = $this->getKey();
- $content = ItemChestContent::with('chest')->find($id);
-
- if (!$content || !$content->chest_id) {
- return $this->response()->error('宝箱不存在');
- }
-
- // 跳转到宝箱详情页面
- return $this->response()->redirect(
- admin_url("game-items/{$content->chest_id}")
- );
- }
- }
|