fractal->collection($request->user()->sshKeys) ->transformWith($this->getTransformer(UserSSHKeyTransformer::class)) ->toArray(); } /** * Stores a new SSH key for the authenticated user's account. */ public function store(StoreSSHKeyRequest $request): array { $model = $request->user()->sshKeys()->create([ 'name' => $request->input('name'), 'public_key' => $request->getPublicKey(), 'fingerprint' => $request->getKeyFingerprint(), ]); return $this->fractal->item($model) ->transformWith($this->getTransformer(UserSSHKeyTransformer::class)) ->toArray(); } /** * Deletes an SSH key from the user's account. */ public function delete(ClientApiRequest $request, string $identifier): JsonResponse { $request->user()->sshKeys()->where('fingerprint', $identifier)->delete(); return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT); } }