From eadaec1b30a57407cab96ae8e82c581cb34ab358 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 21 May 2024 21:48:16 -0400 Subject: [PATCH] Simplify now that keys are fixed --- .../Api/Application/NodeTransformer.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/Transformers/Api/Application/NodeTransformer.php b/app/Transformers/Api/Application/NodeTransformer.php index 439d5c873..664086e53 100644 --- a/app/Transformers/Api/Application/NodeTransformer.php +++ b/app/Transformers/Api/Application/NodeTransformer.php @@ -23,18 +23,13 @@ class NodeTransformer extends BaseTransformer } /** - * Return a node transformed into a format that can be consumed by the - * external administrative API. + * Return a node transformed into a format that can be consumed by the external administrative API. */ public function transform(Node $node): array { - $response = collect($node->toArray())->mapWithKeys(function ($value, $key) { - // I messed up early in 2016 when I named this column as poorly - // as I did. This is the tragic result of my mistakes. - $key = ($key === 'daemon_sftp') ? 'daemon_sftp' : $key; - - return [snake_case($key) => $value]; - })->toArray(); + $response = collect($node->toArray()) + ->mapWithKeys(fn ($value, $key) => [snake_case($key) => $value]) + ->toArray(); $response[$node->getUpdatedAtColumn()] = $this->formatTimestamp($node->updated_at); $response[$node->getCreatedAtColumn()] = $this->formatTimestamp($node->created_at);