Skip to content

Commit 533e2bc

Browse files
committed
Fix database column references in ACP
1 parent 3baa21a commit 533e2bc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/Http/Controllers/Admin/LocationsController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getIndex(Request $request)
4646
'locations' => Models\Location::select(
4747
'locations.*',
4848
DB::raw('(SELECT COUNT(*) FROM nodes WHERE nodes.location = locations.id) as a_nodeCount'),
49-
DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node IN (SELECT nodes.id FROM nodes WHERE nodes.location = locations.id)) as a_serverCount')
49+
DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node_id IN (SELECT nodes.id FROM nodes WHERE nodes.location = locations.id)) as a_serverCount')
5050
)->paginate(20),
5151
]);
5252
}
@@ -56,7 +56,7 @@ public function deleteLocation(Request $request, $id)
5656
$model = Models\Location::select(
5757
'locations.id',
5858
DB::raw('(SELECT COUNT(*) FROM nodes WHERE nodes.location = locations.id) as a_nodeCount'),
59-
DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node IN (SELECT nodes.id FROM nodes WHERE nodes.location = locations.id)) as a_serverCount')
59+
DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node_id IN (SELECT nodes.id FROM nodes WHERE nodes.location = locations.id)) as a_serverCount')
6060
)->where('id', $id)->first();
6161

6262
if (! $model) {

app/Http/Controllers/Admin/NodesController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function getIndex(Request $request)
5757
'nodes' => Models\Node::select(
5858
'nodes.*',
5959
'locations.long as a_locationName',
60-
DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node = nodes.id) as a_serverCount')
60+
DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node_id = nodes.id) as a_serverCount')
6161
)->join('locations', 'nodes.location', '=', 'locations.id')->paginate(20),
6262
]);
6363
}
@@ -110,8 +110,8 @@ public function getView(Request $request, $id)
110110
'servers' => Models\Server::select('servers.*', 'users.email as a_ownerEmail', 'services.name as a_serviceName')
111111
->join('users', 'users.id', '=', 'servers.owner_id')
112112
->join('services', 'services.id', '=', 'servers.service_id')
113-
->where('node', $id)->paginate(10, ['*'], 'servers'),
114-
'stats' => Models\Server::select(DB::raw('SUM(memory) as memory, SUM(disk) as disk'))->where('node', $node->id)->first(),
113+
->where('node_id', $id)->paginate(10, ['*'], 'servers'),
114+
'stats' => Models\Server::select(DB::raw('SUM(memory) as memory, SUM(disk) as disk'))->where('node_id', $node->id)->first(),
115115
'locations' => Models\Location::all(),
116116
'allocations' => Models\Allocation::select('allocations.*', 'servers.name as assigned_to_name')
117117
->where('allocations.node', $node->id)

0 commit comments

Comments
 (0)