count = $count; $this->title = " {$count}次随机奖励"; } /** * 渲染操作按钮 * * @return string */ public function render() { $group = GameRewardGroup::find($this->getKey()); if (!$group) { return '奖励组不存在'; } // 创建弹窗表格 $modal = Modal::make() ->xl() ->title("{$this->count}次随机奖励模拟结果 - {$group->name}") ->body(RandomRewardResultLazyRenderable::make()->payload([ 'group_id' => $this->getKey(), 'count' => $this->count ])) ->button($this->title); return $modal->render(); } /** * 处理请求(这个方法在使用Modal时不会被调用) * * @param Request $request * @return mixed */ public function handle(Request $request) { // 使用Modal时此方法不会被调用 return $this->response()->success('操作完成'); } }