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
1 changed files with 2 additions and 1 deletions

View File

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