mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 13:14:45 +02:00
Simplify now that keys are fixed
This commit is contained in:
parent
a9e58bb493
commit
eadaec1b30
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user