diff --git a/app/Http/Controllers/DomainController.php b/app/Http/Controllers/DomainController.php index 2634622b..6caa2016 100644 --- a/app/Http/Controllers/DomainController.php +++ b/app/Http/Controllers/DomainController.php @@ -149,13 +149,13 @@ public function destroy(Domain $domain) abort_if(Auth::User()->role !== 1, Response::HTTP_FORBIDDEN, '403 Forbidden'); // Has measures ? - abort_if( - DB::table('measures') - ->where('domain_id', $domain->id) - ->exists(), - Response::HTTP_FORBIDDEN, - '403 Forbidden' - ); + if (DB::table('measures') + ->where('domain_id', $domain->id) + ->exists()) { + return back() + ->withErrors(['msg' => 'There are controls associated with this framework !']) + ->withInput(); + } $domain->delete(); diff --git a/resources/views/domains/show.blade.php b/resources/views/domains/show.blade.php index 15b27529..b2fb8f3b 100644 --- a/resources/views/domains/show.blade.php +++ b/resources/views/domains/show.blade.php @@ -3,6 +3,17 @@ @section("content")