Total Complexity | 6 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 7 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
7 | class UserProvider |
||
8 | { |
||
9 | |||
10 | public function makeAdmin($id, $is_super = false) |
||
11 | { |
||
12 | $user = $this->findUser($id); |
||
13 | |||
14 | if ($user->panelAdmin()->exists()){ |
||
15 | return [ |
||
16 | 'type' => 'error', |
||
17 | 'message' => 'User already is an admin!' |
||
18 | ]; |
||
19 | } |
||
20 | |||
21 | $user->panelAdmin()->create([ |
||
22 | 'is_superuser' => $is_super, |
||
23 | ]); |
||
24 | |||
25 | return [ |
||
26 | 'type' => 'success', |
||
27 | 'message' => "User '$id' was converted to an admin", |
||
28 | ]; |
||
29 | } |
||
30 | |||
31 | public function getAdmins() |
||
32 | { |
||
33 | return $this->getUserModel()::query()->whereHas('panelAdmin')->with('panelAdmin')->get(); |
||
34 | } |
||
35 | |||
36 | public function findUser($id) |
||
37 | { |
||
38 | return $this->getUserModel()::query()->findOrFail($id); |
||
39 | } |
||
40 | |||
41 | public function deleteAdmin($id) |
||
46 | } |
||
47 | |||
48 | private function getUserModel() |
||
51 | } |
||
52 | |||
54 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths