structured_json) { return false; } $payload = [ 'candidate_id' => $candidate->id, 'source_file_id' => $candidate->source_file_id, 'source_paper_id' => $candidate->source_paper_id, 'part_id' => $candidate->part_id, 'question_number' => $candidate->question_number ?? $candidate->index, 'structured' => json_decode($candidate->structured_json, true), ]; $base = rtrim(config('services.question_bank.base_url'), '/'); $endpoint = $base . '/ingest/from-filament'; try { $response = Http::timeout(config('services.question_bank.timeout', 60)) ->post($endpoint, $payload); if ($response->failed()) { Log::warning('Question bank sync failed', [ 'candidate_id' => $candidate->id, 'status' => $response->status(), 'body' => $response->body(), ]); return false; } return true; } catch (\Throwable $e) { Log::error('Question bank sync error', [ 'candidate_id' => $candidate->id, 'error' => $e->getMessage(), ]); return false; } } }