Improvements for host selection, store ftn message in utf8

This commit is contained in:
Deon George
2021-07-05 23:17:00 +10:00
parent 5c5df12816
commit fe2784f98f
3 changed files with 11 additions and 9 deletions

View File

@@ -79,22 +79,20 @@ class SystemController extends Controller
'host_id_new' => [
'required',
new TwoByteInteger,
function ($attribute,$value,$fail) {
function ($attribute,$value,$fail) use ($request) {
// Check that the region doesnt already exist
$o = Address::where(function($query) use ($value) {
return $query->where('region_id',$value)
->where('host_id',0)
->where('node_id',0)
->where('point_id',0)
->where('role',DomainController::NODE_RC);
})
// Check that a host doesnt already exist
->orWhere(function($query) use ($value) {
return $query->where('host_id',$value)
->where('node_id',0)
->where('point_id',0)
->where('role',DomainController::NODE_NC);
});
})
->where('zone_id',$request->post('zone_id'))
->where('point_id',0)
->where('active',TRUE);
if ($o->count()) {
$fail('Region or host already exists');