$settings->effectiveForForm(), ]); } public function update(Request $request, SettingsService $settings) { $data = $request->validate([ 'telegram_bot_token' => ['nullable', 'string', 'max:255'], 'telegram_owner_chat_id' => ['nullable', 'string', 'max:64'], 'channels_max_per_agent' => ['nullable', 'integer', 'min:1', 'max:100'], 'channels_domains' => ['nullable', 'string', 'max:4000'], ]); $domains = SettingsService::parseDomains($data['channels_domains'] ?? null); $settings->putMany([ 'telegram.bot_token' => $data['telegram_bot_token'] ?? null, 'telegram.owner_chat_id' => $data['telegram_owner_chat_id'] ?? null, 'channels.max_per_agent' => isset($data['channels_max_per_agent']) ? (string) $data['channels_max_per_agent'] : null, // Persist normalized comma-separated list (empty clears override to []). 'channels.domains' => $domains === [] ? '' : implode(',', $domains), ]); return response()->json(['code' => 0, 'msg' => '已保存']); } }