Validation fix when creating a new host

This commit is contained in:
Deon George 2021-07-26 21:53:56 +10:00
parent ae37067a74
commit 6f26bc4c71

View File

@ -144,13 +144,14 @@ class SystemController extends Controller
// Check that the region doesnt already exist // Check that the region doesnt already exist
$o = Address::where(function($query) use ($request,$value) { $o = Address::where(function($query) use ($request,$value) {
return $query return $query
->where('zone_id',$request->post('zone_id'))
->where('host_id',$request->post('host_id')) ->where('host_id',$request->post('host_id'))
->where('node_id',$value) ->where('node_id',$value)
->where('point_id',0); ->where('point_id',0);
}); });
if ($o->count()) { if ($o->count()) {
$fail('Host already exists'); $fail(sprintf('Host already exists: %s',$o->get()->pluck('ftn')->join(',')));
} }
}, },
], ],