| Conditions | 2 | 
| Paths | 7 | 
| Total Lines | 20 | 
| Code Lines | 11 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 7 | 
| CRAP Score | 2.108 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 13 | 2 | public function handle($id)  | 
            |
| 14 |     { | 
            ||
| 15 |         try { | 
            ||
| 16 | 2 | DB::beginTransaction();  | 
            |
| 17 | |||
| 18 | 2 | $module = Module::findOrFail($id);  | 
            |
| 19 | |||
| 20 | 2 | Relation::deleteRelationsOf($module->getMorphClass(), $module->id);  | 
            |
| 21 | |||
| 22 | 2 | // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug.  | 
            |
| 23 | $module->update([  | 
            ||
| 24 | 2 | 'slug' => $module->slug . $this->appendDeleteMarker(),  | 
            |
| 25 | ]);  | 
            ||
| 26 | |||
| 27 | $module->delete();  | 
            ||
| 28 | |||
| 29 | 2 | DB::commit();  | 
            |
| 30 |         } catch (\Throwable $e) { | 
            ||
| 31 | DB::rollBack();  | 
            ||
| 32 | throw $e;  | 
            ||
| 33 | }  | 
            ||
| 41 |