Passed
Push — dev5 ( eac481...52ae9a )
by Ron
08:27
created
app/Policies/GatePolicy.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
     //  Determine if a user can see the Administration Nav Link
37 37
     public function seeAdminLink(User $user)
38 38
     {
39
-        if ($this->isInstaller($user))
39
+        if($this->isInstaller($user))
40 40
         {
41 41
             return true;
42 42
         }
43 43
 
44 44
         $data = UserRolePermissions::with('UserRolePermissionTypes')
45
-            ->whereHas('UserRolePermissionTypes', function ($query) {
45
+            ->whereHas('UserRolePermissionTypes', function($query) {
46 46
                 $query->where('description', 'Manage Users')
47 47
                     ->orWhere('description', 'Manage User Roles')
48 48
                     ->orWhere('description', 'Manage Customers')
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             ->get();
54 54
 
55 55
         $allow = $data->isEmpty() ? 'false' : 'true';
56
-        \Log::debug('User ' . $user->full_name . ' is trying to access admin link.  Result - ' . $allow);
56
+        \Log::debug('User '.$user->full_name.' is trying to access admin link.  Result - '.$allow);
57 57
 
58 58
         return  $data->isEmpty() ? false : true;
59 59
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         }
69 69
 
70 70
         $data = UserRolePermissions::with('UserRolePermissionTypes')
71
-            ->whereHas('UserRolePermissionTypes', function ($query) use ($task) {
71
+            ->whereHas('UserRolePermissionTypes', function($query) use ($task) {
72 72
                 $query->where('description', $task);
73 73
             })
74 74
             ->where('role_id', $user->role_id)
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             ->get();
77 77
 
78 78
         $allow = $data->isEmpty() ? 'false' : 'true';
79
-        \Log::debug('User '.$user->full_name.' is trying to access '.$task.'.  Result - ' . $allow);
79
+        \Log::debug('User '.$user->full_name.' is trying to access '.$task.'.  Result - '.$allow);
80 80
 
81 81
         return  $data->isEmpty() ? false : true;
82 82
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/UserController.php 2 patches
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -181,12 +181,18 @@  discard block
 block discarded – undo
181 181
 
182 182
         //  Good to go - update user password
183 183
         $roleArr = [];
184
-        foreach ($roles as $role) {
185
-            if ($role->role_id == 1 && Auth::user()->role_id != 1) {
184
+        foreach ($roles as $role)
185
+        {
186
+            if ($role->role_id == 1 && Auth::user()->role_id != 1)
187
+            {
186 188
                 continue;
187
-            } else if ($role->role_id == 2 && Auth::user()->role_id > 1) {
189
+            }
190
+            else if ($role->role_id == 2 && Auth::user()->role_id > 1)
191
+            {
188 192
                 continue;
189
-            } else {
193
+            }
194
+            else
195
+            {
190 196
                 // $roleArr[$role->role_id] = $role->name;
191 197
                 $roleArr[] = [
192 198
                     'value' => $role->role_id,
@@ -275,17 +281,20 @@  discard block
 block discarded – undo
275 281
         $user = User::find($request->user_id);
276 282
 
277 283
         //  Verify this is a valid user ID
278
-        if (!$user) {
284
+        if (!$user)
285
+        {
279 286
             $success = false;
280 287
             $reason  = 'Cannot find user with this ID';
281 288
         }
282 289
         //  Make sure that the user is not trying to deactivate someone with more permissions
283
-        else if ($user->role_id < Auth::user()->role_id) {
290
+        else if ($user->role_id < Auth::user()->role_id)
291
+        {
284 292
             $success = false;
285 293
             $reason  = 'You cannot change password for a user with higher permissions that you.  If this user has locked themselves out, have then use the reset link on the login page.';
286 294
         }
287 295
         //  Good to go - update user password
288
-        else {
296
+        else
297
+        {
289 298
             //  Update the user data
290 299
             $user->update(
291 300
             [
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public function __construct()
31 31
     {
32 32
         $this->middleware('auth')->except('initializeUser', 'submitInitializeUser');
33
-        $this->middleware(function ($request, $next) {
33
+        $this->middleware(function($request, $next) {
34 34
             $this->authorize('hasAccess', 'Manage Users');
35 35
             return $next($request);
36 36
         });
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
     //  Show the list of current users to edit
40 40
     public function index()
41 41
     {
42
-        $userList = new UserCollection(User::with(['UserLogins' => function ($query) {
42
+        $userList = new UserCollection(User::with(['UserLogins' => function($query) {
43 43
             $query->latest()->limit(1);
44 44
         }])->get()
45 45
             /** @scrutinizer ignore-call */
46 46
             ->makeVisible('user_id'));
47
-        $route    = 'admin.user.edit';
47
+        $route = 'admin.user.edit';
48 48
 
49 49
         return view('admin.userIndex', [
50 50
             'userList' => $userList,
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     //  List all inactive users
148 148
     public function show($type)
149 149
     {
150
-        $route    = '';
150
+        $route = '';
151 151
 
152 152
         if($type !== 'inactive')
153 153
         {
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
         $user  = new UserResource(User::findOrFail($id));
172 172
 
173 173
         //  Make sure that the user is not trying to deactivate someone with more permissions
174
-        if ($user->role_id < Auth::user()->role_id)
174
+        if($user->role_id < Auth::user()->role_id)
175 175
         {
176 176
             return abort(403);
177 177
         }
178 178
 
179 179
         //  Good to go - update user password
180 180
         $roleArr = [];
181
-        foreach ($roles as $role) {
182
-            if ($role->role_id == 1 && Auth::user()->role_id != 1) {
181
+        foreach($roles as $role) {
182
+            if($role->role_id == 1 && Auth::user()->role_id != 1) {
183 183
                 continue;
184
-            } else if ($role->role_id == 2 && Auth::user()->role_id > 1) {
184
+            } else if($role->role_id == 2 && Auth::user()->role_id > 1) {
185 185
                 continue;
186 186
             } else {
187 187
                 // $roleArr[$role->role_id] = $role->name;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             }
193 193
         }
194 194
 
195
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
195
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
196 196
         return view('admin.userEdit', [
197 197
             'roles' => $roleArr,
198 198
             'user'  => $user->
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         //  Update the user data
232 232
         $user = User::findOrFail($id);
233 233
 
234
-        if ($user->role_id < Auth::user()->role_id)
234
+        if($user->role_id < Auth::user()->role_id)
235 235
         {
236 236
             return abort(403);
237 237
         }
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
         $user = User::find($request->user_id);
275 275
 
276 276
         //  Verify this is a valid user ID
277
-        if (!$user) {
277
+        if(!$user) {
278 278
             $success = false;
279 279
             $reason  = 'Cannot find user with this ID';
280 280
         }
281 281
         //  Make sure that the user is not trying to deactivate someone with more permissions
282
-        else if ($user->role_id < Auth::user()->role_id) {
282
+        else if($user->role_id < Auth::user()->role_id) {
283 283
             $success = false;
284 284
             $reason  = 'You cannot change password for a user with higher permissions that you.  If this user has locked themselves out, have then use the reset link on the login page.';
285 285
         }
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
                 'password_expires' => $nextChange
293 293
             ]);
294 294
             $success = true;
295
-            $reason  = 'Password for ' . $user->full_name . ' successfully reset.';
295
+            $reason  = 'Password for '.$user->full_name.' successfully reset.';
296 296
         }
297 297
 
298
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
299
-        Log::notice('User ID-' . $request->user_id . ' password chagned by ' . Auth::user()->user_id, [
298
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
299
+        Log::notice('User ID-'.$request->user_id.' password chagned by '.Auth::user()->user_id, [
300 300
             'success' => $success,
301 301
             'reason'  => $reason,
302 302
         ]);
Please login to merge, or discard this patch.
app/Http/Controllers/Installer/CategoriesController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     public function __construct()
16 16
     {
17 17
         $this->middleware('auth');
18
-        $this->middleware(function ($request, $next) {
18
+        $this->middleware(function($request, $next) {
19 19
             $this->authorize('hasAccess', 'Manage Equipment');
20 20
             return $next($request);
21 21
         });
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             SystemCategories::find($id)->delete();
122 122
             return response()->json(['success' => true, 'reason' => 'Category Successfully Deleted']);
123 123
         }
124
-        catch (\Illuminate\Database\QueryException $e)
124
+        catch(\Illuminate\Database\QueryException $e)
125 125
         {
126 126
             return response()->json(['success' => false, 'reason' => 'Category still in use.  You must delete all systems attached to this category first.']);
127 127
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,8 @@
 block discarded – undo
77 77
     //  Delete an existing category - note this will fail if the category has systems assigned to it
78 78
     public function destroy($id)
79 79
     {
80
-        try {
80
+        try
81
+        {
81 82
             SystemCategories::find($id)->delete();
82 83
             return response()->json(['success' => true, 'reason' => 'Category Successfully Deleted']);
83 84
         }
Please login to merge, or discard this patch.
app/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     //  Database primary key
22 22
     protected $primaryKey = 'user_id';
23 23
 
24
-    protected $appends = [ 'full_name' ];
24
+    protected $appends = ['full_name'];
25 25
     protected $casts = [
26 26
         'created_at' => 'datetime:M d, Y',
27 27
         'updated_at' => 'datetime:M d, Y',
Please login to merge, or discard this patch.
database/factories/UserRolePermissionTypesFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 use App\UserRolePermissionTypes;
6 6
 use Faker\Generator as Faker;
7 7
 
8
-$factory->define(UserRolePermissionTypes::class, function (Faker $faker) {
8
+$factory->define(UserRolePermissionTypes::class, function(Faker $faker) {
9 9
     return [
10 10
         //
11 11
         'description' => $faker->words(2, true),
Please login to merge, or discard this patch.
database/factories/UserRolePermissionsFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 use App\UserRolePermissions;
6 6
 use Faker\Generator as Faker;
7 7
 
8
-$factory->define(UserRolePermissions::class, function () {
8
+$factory->define(UserRolePermissions::class, function() {
9 9
     return [
10 10
         //
11 11
         'role_id'      => factory(App\UserRoleType::class)->create()->role_id,
Please login to merge, or discard this patch.
app/Http/Controllers/Installer/SystemsController.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
     }
210 210
 
211 211
     //  Delete an existing system - note this will fail if the system has any customers or tech tips assigned to it
212
-   public function destroy($id)
213
-   {
214
-       //
215
-       try {
212
+    public function destroy($id)
213
+    {
214
+        //
215
+        try {
216 216
             SystemTypes::find($id)->delete();
217 217
             return response()->json(['success' => true, 'reason' => 'Equipment Successfully Deleted']);
218 218
         }
@@ -220,5 +220,5 @@  discard block
 block discarded – undo
220 220
         {
221 221
             return response()->json(['success' => false, 'reason' => 'Cannot delete this equipment.  It has Customers or Tech Tips assigned to it.  Please delete those first.']);
222 222
         }
223
-   }
223
+    }
224 224
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     public function __construct()
19 19
     {
20 20
         $this->middleware('auth');
21
-        $this->middleware(function ($request, $next) {
21
+        $this->middleware(function($request, $next) {
22 22
             $this->authorize('hasAccess', 'Manage Equipment');
23 23
             return $next($request);
24 24
         });
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $fields = SystemDataFieldTypes::all();
121 121
         $cat = SystemCategories::where('name', str_replace('-', ' ', $cat))->first();
122 122
 
123
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
123
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
124 124
         return view('installer.newSystem', [
125 125
             'cat'      => $cat,
126 126
             'dataList' => $fields,
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             $query->join('system_data_field_types', 'system_data_fields.data_type_id', '=', 'system_data_field_types.data_type_id');
137 137
         }])->withCount('SystemDataFields')->first();
138 138
 
139
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
139
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
140 140
         return view('installer.editSystem', [
141 141
             'system'   => $system,
142 142
             'dataList' => $fields,
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             SystemTypes::find($id)->delete();
217 217
             return response()->json(['success' => true, 'reason' => 'Equipment Successfully Deleted']);
218 218
         }
219
-        catch (\Illuminate\Database\QueryException $e)
219
+        catch(\Illuminate\Database\QueryException $e)
220 220
         {
221 221
             return response()->json(['success' => false, 'reason' => 'Cannot delete this equipment.  It has Customers or Tech Tips assigned to it.  Please delete those first.']);
222 222
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -131,8 +131,7 @@  discard block
 block discarded – undo
131 131
     public function edit($id)
132 132
     {
133 133
         $fields = SystemDataFieldTypes::all();
134
-        $system = SystemTypes::where('sys_id', $id)->with(['SystemDataFields' => function($query)
135
-        {
134
+        $system = SystemTypes::where('sys_id', $id)->with(['SystemDataFields' => function($query) {
136 135
             $query->join('system_data_field_types', 'system_data_fields.data_type_id', '=', 'system_data_field_types.data_type_id');
137 136
         }])->withCount('SystemDataFields')->first();
138 137
 
@@ -212,7 +211,8 @@  discard block
 block discarded – undo
212 211
    public function destroy($id)
213 212
    {
214 213
        //
215
-       try {
214
+       try
215
+       {
216 216
             SystemTypes::find($id)->delete();
217 217
             return response()->json(['success' => true, 'reason' => 'Equipment Successfully Deleted']);
218 218
         }
Please login to merge, or discard this patch.
app/Http/Controllers/Installer/SettingsController.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 
40 40
         Settings::firstOrCreate(
41 41
             ['key'   => 'app.logo'],
42
-            ['key'   => 'app.logo', 'value' => '/storage/img/' . $fileName]
43
-        )->update(['value' => '/storage/img/' . $fileName]);
42
+            ['key'   => 'app.logo', 'value' => '/storage/img/'.$fileName]
43
+        )->update(['value' => '/storage/img/'.$fileName]);
44 44
 
45
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
45
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
46 46
         Log::debug('Submitted Data - ', $request->toArray());
47
-        Log::notice('A new company logo has been uploaded by User ID-' . Auth::user()->user_id);
47
+        Log::notice('A new company logo has been uploaded by User ID-'.Auth::user()->user_id);
48 48
 
49
-        return response()->json(['url' => '/storage/img/' . $fileName]);
49
+        return response()->json(['url' => '/storage/img/'.$fileName]);
50 50
     }
51 51
 
52 52
     public function configuration()
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
             )->update(['value' => $request->url]);
82 82
         }
83 83
         //  Update the site timezone
84
-        if (config('app.timezone') !== $request->timezone) {
84
+        if(config('app.timezone') !== $request->timezone) {
85 85
             Settings::firstOrCreate(
86 86
                 ['key'   => 'app.timezone'],
87 87
                 ['key'   => 'app.timezone', 'value' => $request->timezone]
88 88
             )->update(['value' => $request->timezone]);
89 89
         }
90 90
         //  Update the maximum file upload size
91
-        if (config('filesystems.paths.max_size') !== $request->filesize) {
91
+        if(config('filesystems.paths.max_size') !== $request->filesize) {
92 92
             Settings::firstOrCreate(
93 93
                 ['key'   => 'filesystems.paths.max_size'],
94 94
                 ['key'   => 'filesystems.paths.max_size', 'value' => $request->filesize]
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,14 +81,16 @@
 block discarded – undo
81 81
             )->update(['value' => $request->url]);
82 82
         }
83 83
         //  Update the site timezone
84
-        if (config('app.timezone') !== $request->timezone) {
84
+        if (config('app.timezone') !== $request->timezone)
85
+        {
85 86
             Settings::firstOrCreate(
86 87
                 ['key'   => 'app.timezone'],
87 88
                 ['key'   => 'app.timezone', 'value' => $request->timezone]
88 89
             )->update(['value' => $request->timezone]);
89 90
         }
90 91
         //  Update the maximum file upload size
91
-        if (config('filesystems.paths.max_size') !== $request->filesize) {
92
+        if (config('filesystems.paths.max_size') !== $request->filesize)
93
+        {
92 94
             Settings::firstOrCreate(
93 95
                 ['key'   => 'filesystems.paths.max_size'],
94 96
                 ['key'   => 'filesystems.paths.max_size', 'value' => $request->filesize]
Please login to merge, or discard this patch.
app/Http/Middleware/CheckPasswordExpire.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
             if(Auth::user()->password_expires !== null)
26 26
             {
27 27
                 $passExp = new Carbon((Auth::user()->password_expires));
28
-                if(Carbon::now() > $passExp )
28
+                if(Carbon::now() > $passExp)
29 29
                 {
30 30
                     Log::notice('User ID-'.Auth::user()->user_id.' is being forced to change their password.');
31 31
                     $request->session()->flash('change_password', 'change_password');
Please login to merge, or discard this patch.