Total Complexity | 8 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class PageObserver |
||
13 | { |
||
14 | public function created(PageModel $pageModel) |
||
|
|||
15 | { |
||
16 | // |
||
17 | } |
||
18 | |||
19 | public function updated(PageModel $pageModel) |
||
20 | { |
||
21 | // |
||
22 | } |
||
23 | |||
24 | public function deleted(PageModel $pageModel) |
||
25 | { |
||
26 | Log::info('Deleting all data from the page internal id: ' . $pageModel->id); |
||
27 | DB::transaction(function () use($pageModel){ |
||
28 | try { |
||
29 | $characteristic = CharacteristicsModel::query()->where('page_id', $pageModel->page_id)->first(); |
||
30 | if (isset($characteristic)) { |
||
31 | $characteristic->delete(); |
||
32 | if (is_file($characteristic->picturePath())) { |
||
33 | unlink($characteristic->picturePath()); |
||
34 | } |
||
35 | |||
36 | UserCharacteristicsModel::query()->where('characteristic_id', $characteristic->id)->delete(); |
||
37 | } |
||
38 | } catch (\Throwable $e) { |
||
39 | Log::emergency('Error deleting all data from the page internal id: ' . $pageModel->id); |
||
40 | throw $e; |
||
41 | } |
||
42 | }); |
||
43 | } |
||
44 | |||
45 | public function restored(PageModel $pageModel) |
||
47 | // |
||
48 | } |
||
49 | |||
50 | public function forceDeleted(PageModel $pageModel) |
||
52 | // |
||
53 | } |
||
54 | } |
||
55 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.