From 25f853cea4c265c295c7cd914c9fc3e6d37898f5 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 24 Jun 2021 22:28:06 +1000 Subject: [PATCH] Fix zone update with zt_id, added some ZeroTier network settings --- app/Http/Controllers/ZoneController.php | 8 +++-- app/Models/Zone.php | 10 ++++++ resources/views/system/addedit.blade.php | 2 +- resources/views/zone/addedit.blade.php | 42 ++++++++++++++++++++++-- 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ZoneController.php b/app/Http/Controllers/ZoneController.php index c6a5636..68f83d6 100644 --- a/app/Http/Controllers/ZoneController.php +++ b/app/Http/Controllers/ZoneController.php @@ -35,11 +35,15 @@ class ZoneController extends Controller }) ], 'system_id' => 'required|exists:systems,id', - 'ztid' => 'nullable|size:10|regex:/^([A-Fa-f0-9]){10}$/', + 'zt_id' => 'nullable|size:10|regex:/^([A-Fa-f0-9]){10}$/', + 'zt_ipv4' => 'nullable|ipv4', + 'zt_ipv4_mask' => 'nullable|numeric|lte:31', + 'zt_ipv6' => 'nullable|ipv6', + 'zt_ipv6_mask' => 'nullable|numeric|lte:112', 'active' => 'required|boolean', ]); - foreach (['zone_id','domain_id','system_id','active','notes','ztid'] as $key) + foreach (['zone_id','domain_id','system_id','active','notes','zt_id','zt_ipv4','zt_ipv4_mask','zt_ipv6','zt_ipv6_mask'] as $key) $o->{$key} = $request->post($key); $o->save(); diff --git a/app/Models/Zone.php b/app/Models/Zone.php index c9a23c0..ab2595f 100644 --- a/app/Models/Zone.php +++ b/app/Models/Zone.php @@ -10,6 +10,16 @@ class Zone extends Model { use ScopeActive; + /* SCOPES */ + + public function scopeDomainZoneOrder($query) + { + return $query + ->join('domains',['domains.id'=>'zones.domain_id']) + ->orderBy('domains.name') + ->orderBy('zone_id'); + } + /* RELATIONS */ public function addresses() diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php index fa630a8..f957d83 100644 --- a/resources/views/system/addedit.blade.php +++ b/resources/views/system/addedit.blade.php @@ -311,7 +311,7 @@ diff --git a/resources/views/zone/addedit.blade.php b/resources/views/zone/addedit.blade.php index a4b0d2f..dbdb132 100644 --- a/resources/views/zone/addedit.blade.php +++ b/resources/views/zone/addedit.blade.php @@ -87,17 +87,53 @@
- +
- + - @error('ztid') + @error('zt_id') {{ $message }} @enderror
+ +
+ +
+ + + / + + + @error('zt_ipv4') + {{ $message }} + @enderror + @error('zt_ipv4_mask') + {{ $message }} + @enderror + +
+
+ +
+ +
+ + + / + + + @error('zt_ipv6') + {{ $message }} + @enderror + @error('zt_ipv6_mask') + {{ $message }} + @enderror + +
+