Set out some roach traps to catch all these 🐛

This commit is contained in:
Dane Everitt
2017-02-16 13:56:28 -05:00
parent 336234843d
commit 2e134b7a55
8 changed files with 24 additions and 25 deletions

View File

@@ -187,7 +187,7 @@ class NodeController extends BaseController
*/
public function allocationsView(Request $request, $id)
{
return Models\Allocation::where('assigned_to', $id)->get()->toArray();
return Models\Allocation::where('server_id', $id)->get()->toArray();
}
/**

View File

@@ -159,7 +159,7 @@ class NodesController extends Controller
public function deallocateSingle(Request $request, $node, $allocation)
{
$query = Models\Allocation::where('node', $node)->whereNull('assigned_to')->where('id', $allocation)->delete();
$query = Models\Allocation::where('node', $node)->whereNull('server_id')->where('id', $allocation)->delete();
if ((int) $query === 0) {
return response()->json([
'error' => 'Unable to find an allocation matching those details to delete.',
@@ -171,7 +171,7 @@ class NodesController extends Controller
public function deallocateBlock(Request $request, $node)
{
$query = Models\Allocation::where('node', $node)->whereNull('assigned_to')->where('ip', $request->input('ip'))->delete();
$query = Models\Allocation::where('node', $node)->whereNull('server_id')->where('ip', $request->input('ip'))->delete();
if ((int) $query === 0) {
Alert::danger('There was an error while attempting to delete allocations on that IP.')->flash();

View File

@@ -115,7 +115,7 @@ class ServersController extends Controller
], 500);
}
return response()->json(Models\Node::select('id', 'name', 'public')->where('location', $request->input('location'))->get());
return response()->json(Models\Node::select('id', 'name', 'public')->where('location_id', $request->input('location'))->get());
}
/**
@@ -132,7 +132,7 @@ class ServersController extends Controller
], 500);
}
$ips = Models\Allocation::where('node', $request->input('node'))->whereNull('assigned_to')->get();
$ips = Models\Allocation::where('node_id', $request->input('node'))->whereNull('server_id')->get();
$listing = [];
foreach ($ips as &$ip) {

View File

@@ -181,7 +181,7 @@ class AjaxController extends Controller
}
try {
$allocation = $server->allocations->where('id', $request->input('allocation'))->where('assigned_to', $server->id)->first();
$allocation = $server->allocations->where('id', $request->input('allocation'))->where('server_id', $server->id)->first();
if (! $allocation) {
return response()->json([
'error' => 'No allocation matching your request was found in the system.',