Skip to content

Commit

Permalink
Update DatabaseHostTransformer
Browse files Browse the repository at this point in the history
  • Loading branch information
go-vehikl committed Nov 21, 2024
1 parent 18a7cc3 commit 308f706
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/Transformers/Api/Application/DatabaseHostTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function transform(DatabaseHost $model): array
'host' => $model->host,
'port' => $model->port,
'username' => $model->username,
'node' => $model->node_id,
'created_at' => $model->created_at->toAtomString(),
'updated_at' => $model->updated_at->toAtomString(),
];
Expand All @@ -58,14 +57,14 @@ public function includeDatabases(DatabaseHost $model): Collection|NullResource
/**
* Include the nodes associated with this host.
*/
public function includeNodes(DatabaseHost $model): Item|NullResource
public function includeNodes(DatabaseHost $model): Collection|NullResource
{
if (!$this->authorize(Node::RESOURCE_NAME)) {
return $this->null();
}

$model->loadMissing('nodes');

return $this->item($model->getRelation('nodes'), $this->makeTransformer(NodeTransformer::class), Node::RESOURCE_NAME);
return $this->collection($model->getRelation('nodes'), $this->makeTransformer(NodeTransformer::class), Node::RESOURCE_NAME);
}
}

0 comments on commit 308f706

Please sign in to comment.