'Update Claude Prompt', 'message' => 'You have successfully updated the Claude prompt' ]; } /** @var CanUpdateClaudePrompt */ private $canUpdateClaudePrompt; /** @var UpdatesKeyValuePair */ private $updatesKeyValuePair; /** @var FetchesKeyValuePair */ private $fetchesKeyValuePair; /** * UpdateClaudePromptKVPLogic constructor. * @param CanUpdateClaudePrompt $canUpdateClaudePrompt * @param UpdatesKeyValuePair $updatesKeyValuePair * @param FetchesKeyValuePair $fetchesKeyValuePair */ public function __construct(CanUpdateClaudePrompt $canUpdateClaudePrompt, UpdatesKeyValuePair $updatesKeyValuePair, FetchesKeyValuePair $fetchesKeyValuePair) { $this->canUpdateClaudePrompt = $canUpdateClaudePrompt; $this->updatesKeyValuePair = $updatesKeyValuePair; $this->fetchesKeyValuePair = $fetchesKeyValuePair; } /** * @param Request $request * @return JsonResponse * @throws \App\Classes\Exceptions\AccessForbiddenException * @throws \App\Classes\Exceptions\MalformedRequestException * @throws \App\Classes\Exceptions\RequestValidationException */ public function logic(Request $request) : JsonResponse { $dto = new UpdateClaudePromptDTO($request->all()); $this->canUpdateClaudePrompt->passes($dto); $kvp = $this->fetchesKeyValuePair->execute(['id' => $dto->getId()]); $keyValuePairObject = new KeyValuePairObject($kvp->key, $dto->getPrompt()); $this->updatesKeyValuePair->execute($kvp, $keyValuePairObject); return $this->resourceResponse(new ClaudePromptResource($kvp)); } }