From 73a674096af40d2ecab0e733702da17c2028d33f Mon Sep 17 00:00:00 2001 From: miguel456 Date: Sat, 22 Oct 2022 00:19:17 +0100 Subject: [PATCH] fix: fix faulty relationship query preventing form deletion Fixes #12. Signed-off-by: miguel456 --- app/Form.php | 2 +- app/Services/FormManagementService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Form.php b/app/Form.php index 80220fc..59afbae 100755 --- a/app/Form.php +++ b/app/Form.php @@ -40,6 +40,6 @@ class Form extends Model public function responses() { - return $this->belongsTo('App\Response', 'id', 'id'); + return $this->belongsTo('App\Response', 'id', 'responseFormID'); } } diff --git a/app/Services/FormManagementService.php b/app/Services/FormManagementService.php index a7e9ce0..0a59544 100755 --- a/app/Services/FormManagementService.php +++ b/app/Services/FormManagementService.php @@ -39,7 +39,7 @@ class FormManagementService $deletable = true; - if (! is_null($form) && ! is_null($form->vacancies) && $form->vacancies->count() !== 0 || ! is_null($form->responses)) { + if (! is_null($form->vacancies) && $form->vacancies->count() !== 0 || ! is_null($form->responses)) { $deletable = false; }