diff --git a/code/webapp.zip b/code/webapp.zip deleted file mode 100644 index 2cac6489..00000000 Binary files a/code/webapp.zip and /dev/null differ diff --git a/code/webapp/app/Http/Controllers/QuestionListController.php b/code/webapp/app/Http/Controllers/QuestionListController.php index c6fcea1d..53a6c947 100644 --- a/code/webapp/app/Http/Controllers/QuestionListController.php +++ b/code/webapp/app/Http/Controllers/QuestionListController.php @@ -6,6 +6,7 @@ use App\Models\QuestionList; use App\Models\TreePart; use App\Models\Question; +use App\Models\QuestionUserList; use App\Models\Answer; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; @@ -110,6 +111,7 @@ public function destroy($id) $questionList = QuestionList::find($id); $questions = Question::where('question_list_id', $questionList->id)->get(); + QuestionUserList::where('question_list_id', $questionList->id)->delete(); foreach ($questions as $question) { $answers = Answer::where('question_id', $question->id)->get(); foreach($answers as $answer){ diff --git a/code/webapp/app/Http/Controllers/SurveyController.php b/code/webapp/app/Http/Controllers/SurveyController.php index 47da49bc..3e4a19e4 100644 --- a/code/webapp/app/Http/Controllers/SurveyController.php +++ b/code/webapp/app/Http/Controllers/SurveyController.php @@ -109,6 +109,10 @@ public function update(Request $request, $id) public function destroy($id) { Gate::authorize("allowAdmin"); - // + $survey = InfoContent::find($id); + $survey->delete(); + + $msg = "Survey Deleted successful! "; + return redirect("surveys/")->with("msg", $msg); } } diff --git a/code/webapp/resources/views/surveys/index.blade.php b/code/webapp/resources/views/surveys/index.blade.php index dc6e582c..fe1c15d3 100644 --- a/code/webapp/resources/views/surveys/index.blade.php +++ b/code/webapp/resources/views/surveys/index.blade.php @@ -13,10 +13,19 @@
@foreach ($surveys as $survey)