json($review->listing($request))->header('Cache-Control', 'no-store'); } public function preview(Request $request, ModuleAssociationReview $review) { return $this->decision(fn () => $review->preview($request)); } public function associate(Request $request, ModuleAssociationReview $review) { return $this->decision(fn () => $review->confirm($request)); } private function decision(callable $operation) { try { return response()->json($operation())->header('Cache-Control', 'no-store'); } catch (QueryException $e) { // The service transaction has already rolled back. Do not retry a // decision automatically or expose SQL/bindings in the response. if (($e->errorInfo[0] ?? null) !== '55P03') throw $e; return response()->json([ 'code' => 'association_busy', 'message' => 'A conferência está ocupada por outra operação. Aguarde e volte a confirmar; o estado será novamente validado.', ], 423)->header('Cache-Control', 'no-store'); } } }