Skip to content

Commit 65bfd55

Browse files
committed
improve domain removal
1 parent 2e0ac36 commit 65bfd55

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/Http/Controllers/DomainController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,17 @@ public function destroy(Domain $domain)
151151
// Has measures ?
152152
if (DB::table('measures')
153153
->where('domain_id', $domain->id)
154+
->join('control_measure','measures.id','control_measure.measure_id')
154155
->exists()) {
155156
return back()
156-
->withErrors(['msg' => 'There are controls associated with this framework !'])
157+
->withErrors(['msg' => 'There are measures associated with this framework !'])
157158
->withInput();
158159
}
159160

161+
// Delete measures
162+
DB::table('measures')->where('domain_id', $domain->id)->delete();
163+
164+
// Delete domain
160165
$domain->delete();
161166

162167
return redirect('/domains');

0 commit comments

Comments
 (0)