From 0789ee904262e52dcbef23d8a8a387911e443ade Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 15 Aug 2021 17:26:01 +1000 Subject: [PATCH] Fix assigning default when system has more than 1 AKA in different zones --- app/Http/Controllers/ZoneController.php | 2 +- resources/views/system/addedit.blade.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ZoneController.php b/app/Http/Controllers/ZoneController.php index 20d5564..17babe0 100644 --- a/app/Http/Controllers/ZoneController.php +++ b/app/Http/Controllers/ZoneController.php @@ -112,7 +112,7 @@ class ZoneController extends Controller $default = $o->systems->where('pivot.default',TRUE); - if ($default->first()->addresses->pluck('role')->search(DomainController::NODE_ZC) !== FALSE) + if ($default->count() && $default->first()->addresses->pluck('role')->search(DomainController::NODE_ZC) !== FALSE) abort(412); if ($default->count() && ($default->first()->id != $request->sid)) diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php index 6fab553..8636543 100644 --- a/resources/views/system/addedit.blade.php +++ b/resources/views/system/addedit.blade.php @@ -65,7 +65,7 @@ use App\Http\Controllers\DomainController as DC; @if(($x=$oo->systems->where('pivot.default',TRUE))->count() && ($x->first()->id !== $o->id)) @else - + @endif {{ $oo->pivot->sespass }} @@ -288,7 +288,7 @@ use App\Http\Controllers\DomainController as DC; @section('page-scripts')