From 682a8e7d020e8086926f8d77881cc3a3a52e2dc9 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Mon, 21 Nov 2022 11:53:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Modules/HostController.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Modules/HostController.php b/app/Http/Controllers/Modules/HostController.php index 524359d..36a7295 100644 --- a/app/Http/Controllers/Modules/HostController.php +++ b/app/Http/Controllers/Modules/HostController.php @@ -127,14 +127,13 @@ public function update(Request $request, Host $host): JsonResponse */ public function destroy($host): JsonResponse { - if ($host instanceof Host) { - $host->delete(); - } else { + // if host not instance of Host + if (!$host instanceof Host) { $host = Host::findOrFail($host); - - $host?->delete(); } - return $this->deleted($host); + $host?->delete(); + + return $this->deleted(); } }