From 582ddcad7ba0ec05b57591cb024847f1e7747155 Mon Sep 17 00:00:00 2001 From: Sens van Aert Date: Sat, 6 Jan 2024 19:16:52 +0100 Subject: [PATCH] Delete client now also deletes questionUserList and Answer belonging to that client --- code/webapp/app/Http/Controllers/ClientController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/webapp/app/Http/Controllers/ClientController.php b/code/webapp/app/Http/Controllers/ClientController.php index ce4db84d..d3a7cc68 100644 --- a/code/webapp/app/Http/Controllers/ClientController.php +++ b/code/webapp/app/Http/Controllers/ClientController.php @@ -3,6 +3,8 @@ namespace App\Http\Controllers; use App\Http\Requests\StoreUserRequest; +use App\Models\Answer; +use App\Models\QuestionUserList; use App\Models\Department; use App\Models\DepartmentList; use App\Models\Info; @@ -208,6 +210,8 @@ public function destroy($id) DepartmentList::where("user_id", $id)->delete(); UserList::where("client_id", $id)->delete(); + Answer::where("user_id", $id)->delete(); + QuestionUserList::where("user_id", $id)->delete(); $client = User::find($id); $client->delete();