user(); if (! $admin instanceof AdminUser) { return ApiResponse::error( trans('admin.unauthenticated', [], $request->lotteryLocale()), ErrorCode::AdminUnauthenticated->value, null, 401, ); } if ((int) $batch->draw_id !== (int) $draw->id) { return ApiResponse::error( trans('api.not_found', [], $request->lotteryLocale()), ErrorCode::NotFound->value, null, 404, ); } try { $this->publishService->publishManualBatch($batch, $admin); } catch (\RuntimeException $e) { return ApiMessage::runtimeErrorResponse($request, $e); } $draw->refresh(); return ApiResponse::success([ 'draw_no' => $draw->draw_no, 'status' => $draw->status, 'result_version' => (int) $draw->current_result_version, ]); } }