Validation fix when creating a new host

This commit is contained in:
Deon George 2021-07-18 23:38:18 +10:00
parent 5ad342fd56
commit a37da4b099
1 changed files with 9 additions and 7 deletions

View File

@ -82,13 +82,15 @@ class SystemController extends Controller
function ($attribute,$value,$fail) use ($request) { function ($attribute,$value,$fail) use ($request) {
// Check that the region doesnt already exist // Check that the region doesnt already exist
$o = Address::where(function($query) use ($value) { $o = Address::where(function($query) use ($value) {
return $query->where('region_id',$value) return $query->where(function($query) use ($value) {
->where('role',DomainController::NODE_RC); return $query->where('region_id',$value)
}) ->where('role',DomainController::NODE_RC);
// Check that a host doesnt already exist })
->orWhere(function($query) use ($value) { // Check that a host doesnt already exist
return $query->where('host_id',$value) ->orWhere(function($query) use ($value) {
->where('role',DomainController::NODE_NC); return $query->where('host_id',$value)
->where('role',DomainController::NODE_NC);
});
}) })
->where('zone_id',$request->post('zone_id')) ->where('zone_id',$request->post('zone_id'))
->where('point_id',0) ->where('point_id',0)