Mail routing parent/children, domain name validation, nodelist import changes and other fixes

This commit is contained in:
Deon George
2021-07-26 21:21:58 +10:00
parent 49bc946024
commit b179b1b3e9
15 changed files with 537 additions and 171 deletions

View File

@@ -5,7 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
use App\Models\Zone;
use App\Models\{Address,Zone};
class ZoneController extends Controller
{
@@ -64,6 +64,30 @@ class ZoneController extends Controller
$o->save();
// Find the zones 0/0 address, and assign it to this host.
$ao = Address::where('zone_id',$request->zone_id)
->where('region_id',0)
->where('host_id',0)
->where('node_id',0)
->where('point_id',0)
->single();
// Its not defined, so we'll create it.
if (! $ao) {
$ao = new Address;
$ao->forceFill([
'region_id'=>0,
'host_id'=>0,
'node_id'=>0,
'point_id'=>0,
'role'=>DomainController::NODE_ZC,
]);
}
$ao->system_id = $request->system_id;
$ao->active = TRUE;
$o->addresses()->save($ao);
return redirect()->action([self::class,'home']);
}