Completed
Pull Request — master (#52)
by Ron
05:19
created
app/Http/Controllers/SystemController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         //  Make sure that the category is valid
36 36
         $valid = SystemCategories::where('name', $cat)->get();
37
-        if($valid->isEmpty())
37
+        if ($valid->isEmpty())
38 38
         {
39 39
             Log::warning('User '.Auth::user()->user_id.' tried to visit invalid category '.$cat);
40 40
             return view('err.badCategory');
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         //  Make sure that the system is valid
59 59
         $sys = urldecode($sys);
60 60
         $valid = SystemTypes::where('name', $sys)->first();
61
-        if(empty($valid))
61
+        if (empty($valid))
62 62
         {
63 63
             Log::warning('User '.Auth::user()->user_id.' tried to visit invalid system - '.$sys.' for category '.$cat);
64 64
             return view('err.badSystem');
Please login to merge, or discard this patch.
app/Http/Controllers/InstallerController.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
         $cats = SystemCategories::all();
32 32
         $sysArr = [];
33 33
         //  Populate that list with the matching systems
34
-        foreach($cats as $cat)
34
+        foreach ($cats as $cat)
35 35
         {
36 36
             $systems = SystemTypes::where('cat_id', $cat->cat_id)->get();
37
-            if(!$systems->isEmpty())
37
+            if (!$systems->isEmpty())
38 38
             {
39
-                foreach($systems as $sys)
39
+                foreach ($systems as $sys)
40 40
                 {
41 41
                     $sysArr[$cat->name][] = $sys->name;
42 42
                 }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         
72 72
         Log::info('Tech Bench Settings Updated', ['user_id' => Auth::user()->user_id]);
73 73
         
74
-        return redirect()->back()->with('success', 'Tech Bench Successfully Updated');//
74
+        return redirect()->back()->with('success', 'Tech Bench Successfully Updated'); //
75 75
     }
76 76
     
77 77
     //  Upload and submit a new site logo
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             'mail.username'   => $request->username,
116 116
         ]);
117 117
         
118
-        if(!empty($request->password))
118
+        if (!empty($request->password))
119 119
         {
120 120
             config(['mail.password' => $request->password]);
121 121
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             Mail::to(Auth::user()->email)->send(new TestEmail());
128 128
             return 'success';
129 129
         }
130
-        catch(Exception $e)
130
+        catch (Exception $e)
131 131
         {
132 132
             Log::notice('Test Email Failed.  Message: '.$e);
133 133
             $msg = '['.$e->getCode().'] "'.$e->getMessage().'" on line '.$e->getTrace()[0]['line'].' of file '.$e->getTrace()[0]['file'];
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
         Settings::where('key', 'mail.port')->update(['value' => $request->port]);
151 151
         Settings::where('key', 'mail.encryption')->update(['value' => $request->encryption]);
152 152
         Settings::where('key', 'mail.username')->update(['value' => $request->username]);
153
-        if(!empty($request->password))
153
+        if (!empty($request->password))
154 154
         {
155 155
             Settings::where('key', 'mail.password')->update(['value' => $request->password]);
156 156
         }
157 157
          
158 158
         Log::info('Email Settings have been changed by User ID-'.Auth::user()->user_id);
159
-        return redirect()->back()->with('success', 'Tech Bench Successfully Updated');//
159
+        return redirect()->back()->with('success', 'Tech Bench Successfully Updated'); //
160 160
     }
161 161
     
162 162
     //  User settings form
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
         
179 179
         //  Determine if the password expires field is updated
180 180
         $oldExpire = config('users.passExpires');
181
-        if($request->passExpire != $oldExpire)
181
+        if ($request->passExpire != $oldExpire)
182 182
         {
183 183
             //  Update the setting in the database
184 184
             Settings::where('key', 'users.passExpires')->update([
185 185
                 'value' => $request->passExpire
186 186
             ]);
187 187
             //  If the setting is changing from never to xx days, update all users
188
-            if($request->passExpire == 0)
188
+            if ($request->passExpire == 0)
189 189
             {
190 190
                 User::whereNotNull('password_expires')->update([
191 191
                     'password_expires' => null
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
         $sysID = $sysData->sys_id;
251 251
         $i = 0;
252 252
         
253
-        foreach($request->custField as $field)
253
+        foreach ($request->custField as $field)
254 254
         {
255
-            if(!empty($field))
255
+            if (!empty($field))
256 256
             {
257 257
                 $id = SystemCustDataTypes::where('name', $field)->first();
258 258
 
259
-                if(is_null($id))
259
+                if (is_null($id))
260 260
                 {
261 261
                     $newField = SystemCustDataTypes::create([
262 262
                         'name' => $field
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         
281 281
         Log::info('New System Created', ['cat_id' => $request->catName, 'sys_name' => $request->name, 'user_id' => Auth::user()->user_id]);
282 282
         
283
-        return redirect()->back()->with('success', 'System Successfully Added');//
283
+        return redirect()->back()->with('success', 'System Successfully Added'); //
284 284
     }
285 285
     
286 286
     //  Form to edit an existing system
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         $sysName = SystemTypes::find($sysID)->name;
308 308
         
309 309
         //  Change the name of the system if it has been modified
310
-        if($sysName !== $request->name)
310
+        if ($sysName !== $request->name)
311 311
         {
312 312
             SystemTypes::find($sysID)->update([
313 313
                 'name' => $request->name
@@ -320,19 +320,19 @@  discard block
 block discarded – undo
320 320
             ->get();
321 321
         
322 322
         $i = 0;
323
-        foreach($request->custField as $field)
323
+        foreach ($request->custField as $field)
324 324
         {
325 325
             $found = false;
326
-            if(!empty($field))
326
+            if (!empty($field))
327 327
             {
328 328
                 //  Check if the field already exists
329
-                foreach($dataType as $type)
329
+                foreach ($dataType as $type)
330 330
                 {
331
-                    if($type->name === $field)
331
+                    if ($type->name === $field)
332 332
                     {
333 333
                         $found = true;
334 334
                         //  See if the order has changed
335
-                        if($type->order != $i)
335
+                        if ($type->order != $i)
336 336
                         {
337 337
                             SystemCustDataFields::find($type->field_id)->update(
338 338
                             [
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
                     }
343 343
                 }
344 344
                 //  If the field does not exist, create it
345
-                if(!$found)
345
+                if (!$found)
346 346
                 {
347 347
                     $id = SystemCustDataTypes::where('name', $field)->first();
348 348
 
349
-                    if(is_null($id))
349
+                    if (is_null($id))
350 350
                     {
351 351
                         $newField = SystemCustDataTypes::create([
352 352
                             'name' => $field
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
                 {
41 41
                     $sysArr[$cat->name][] = $sys->name;
42 42
                 }
43
-            }
44
-            else
43
+            } else
45 44
             {
46 45
                 $sysArr[$cat->name] = null;
47 46
             }
@@ -126,8 +125,7 @@  discard block
 block discarded – undo
126 125
             Log::info('Test Email Successfully Sent to '.Auth::user()->email);
127 126
             Mail::to(Auth::user()->email)->send(new TestEmail());
128 127
             return 'success';
129
-        }
130
-        catch(Exception $e)
128
+        } catch(Exception $e)
131 129
         {
132 130
             Log::notice('Test Email Failed.  Message: '.$e);
133 131
             $msg = '['.$e->getCode().'] "'.$e->getMessage().'" on line '.$e->getTrace()[0]['line'].' of file '.$e->getTrace()[0]['file'];
@@ -190,8 +188,7 @@  discard block
 block discarded – undo
190 188
                 User::whereNotNull('password_expires')->update([
191 189
                     'password_expires' => null
192 190
                 ]);
193
-            }
194
-            else
191
+            } else
195 192
             {
196 193
                 $newExpire = Carbon::now()->addDays($request->passExpire);
197 194
                 User::whereNull('password_expires')->update([
@@ -262,8 +259,7 @@  discard block
 block discarded – undo
262 259
                         'name' => $field
263 260
                     ]);
264 261
                     $id = $newField->data_type_id;
265
-                }
266
-                else
262
+                } else
267 263
                 {
268 264
                     $id = $id->data_type_id;
269 265
                 }
@@ -352,8 +348,7 @@  discard block
 block discarded – undo
352 348
                             'name' => $field
353 349
                         ]);
354 350
                         $id = $newField->data_type_id;
355
-                    }
356
-                    else
351
+                    } else
357 352
                     {
358 353
                         $id = $id->data_type_id;
359 354
                     }
Please login to merge, or discard this patch.