From 58adb63174ac5a71b526a80a25abfa6402302493 Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 29 May 2024 18:59:44 +1000 Subject: [PATCH] Fix for when no zones have been created yet in a domain --- app/Http/Controllers/ZoneController.php | 2 +- app/Http/Requests/SystemRegisterRequest.php | 4 +--- app/Models/Domain.php | 3 ++- resources/views/domain/addedit.blade.php | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ZoneController.php b/app/Http/Controllers/ZoneController.php index 09336ed..81ef762 100644 --- a/app/Http/Controllers/ZoneController.php +++ b/app/Http/Controllers/ZoneController.php @@ -10,7 +10,7 @@ use App\Models\{Address,Zone}; class ZoneController extends Controller { /** - * Add or edit a node + * Add or edit a zone */ public function add_edit(Request $request,Zone $o) { diff --git a/app/Http/Requests/SystemRegisterRequest.php b/app/Http/Requests/SystemRegisterRequest.php index 6577f07..9175ad5 100644 --- a/app/Http/Requests/SystemRegisterRequest.php +++ b/app/Http/Requests/SystemRegisterRequest.php @@ -8,12 +8,10 @@ use Illuminate\Support\Facades\Gate; use Illuminate\Validation\Rule; use App\Classes\FTN\Packet; -use App\Models\{Setup,System}; +use App\Models\Setup; class SystemRegisterRequest extends FormRequest { - private System $so; - /** * Determine if the user is authorized to make this request. * diff --git a/app/Models/Domain.php b/app/Models/Domain.php index 19d3334..260a399 100644 --- a/app/Models/Domain.php +++ b/app/Models/Domain.php @@ -69,7 +69,8 @@ class Domain extends Model public function getCanAcceptAppAttribute(): bool { - return our_address($this)->count() + return ($x=our_address($this)) + && $x->count() && $this->active && $this->accept_app && Auth::id() diff --git a/resources/views/domain/addedit.blade.php b/resources/views/domain/addedit.blade.php index ef37a55..3478c0e 100644 --- a/resources/views/domain/addedit.blade.php +++ b/resources/views/domain/addedit.blade.php @@ -47,7 +47,7 @@ use App\Models\Echoarea;
- @if ($o->zones->count() > 1) + @if ($o->zones?->count() > 1)