Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
Move | |
0.00% |
0 / 13 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
dependency | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
6 | |||
resolve | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace App\Http\Helpers\ChangeManagement\TemplateCategory; |
4 | |
5 | use App\Http\Helpers\ChangeManagement\ChangeManagement; |
6 | use App\Http\Models\Shortcut; |
7 | use App\Http\Models\Template; |
8 | |
9 | class Move extends ChangeManagement |
10 | { |
11 | public function dependency($id) |
12 | { |
13 | $templates = Template::where('category_id', $id)->count(); |
14 | |
15 | $hasDependency = false; |
16 | if ($templates > 0) { |
17 | $hasDependency = true; |
18 | } |
19 | |
20 | return [ |
21 | 'has_dependency' => $hasDependency, |
22 | 'dependency' => [ |
23 | 'templates' => $templates, |
24 | ], |
25 | ]; |
26 | } |
27 | |
28 | public function resolve($id) |
29 | { |
30 | Template::where('category_id', $id)->update(['category_id' => $this->categoryId]); |
31 | Shortcut::where('template_category_id', $id)->update('template_category_id', $this->categoryId); |
32 | |
33 | return true; |
34 | } |
35 | } |