Completed
Pull Request — master (#48)
by Ron
06:04
created
app/Http/Controllers/CustomerContactsController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $numberTypes = PhoneNumberType::all();
27 27
         
28 28
         $numTypes = [];
29
-        foreach($numberTypes as $type)
29
+        foreach ($numberTypes as $type)
30 30
         {
31 31
             $numTypes[$type->phone_type_id] = $type->description;
32 32
         }
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
         
50 50
         $contID = $cont->cont_id;
51 51
         
52
-        if(!empty(array_filter($request['phoneNumber'])))
52
+        if (!empty(array_filter($request['phoneNumber'])))
53 53
         {
54 54
             $num = count($request['phoneNumber']);
55
-            for($i=0; $i < $num; $i++)
55
+            for ($i = 0; $i<$num; $i++)
56 56
             {
57
-                if(!empty($request['phoneNumber'][$i]))
57
+                if (!empty($request['phoneNumber'][$i]))
58 58
                 {
59 59
                     CustomerContactPhones::create([
60 60
                         'cont_id' => $contID,
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $numberTypes = PhoneNumberType::all();
88 88
         
89 89
         $numTypes = [];
90
-        foreach($numberTypes as $type)
90
+        foreach ($numberTypes as $type)
91 91
         {
92 92
             $numTypes[$type->phone_type_id] = $type->description;
93 93
         }
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
         
114 114
         //  Clear all contact phone numbers and re-enter them
115 115
         CustomerContactPhones::where('cont_id', $id)->delete();
116
-        if(!empty(array_filter($request['phoneNumber'])))
116
+        if (!empty(array_filter($request['phoneNumber'])))
117 117
         {
118 118
             $num = count($request['phoneNumber']);
119
-            for($i=0; $i < $num; $i++)
119
+            for ($i = 0; $i<$num; $i++)
120 120
             {
121 121
                 CustomerContactPhones::create([
122 122
                     'cont_id'       => $id,
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
         $vcard->addEmail($contact->email);
159 159
         $vcard->addAddress(null, null, $custData->address, $custData->city, $custData->state, $custData->zip, null);
160 160
         
161
-        if(!empty($numbers))
161
+        if (!empty($numbers))
162 162
         {
163
-            foreach($numbers as $phone)
163
+            foreach ($numbers as $phone)
164 164
             {
165 165
                 $vcard->addPhoneNumber($phone->phone_number, $phone->description);
166 166
             }
Please login to merge, or discard this patch.
app/Http/Controllers/CustomerDetails.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $custDetails = Customers::find($id);
56 56
         
57 57
         //  Check for empty data set
58
-        if(empty($custDetails))
58
+        if (empty($custDetails))
59 59
         {
60 60
             return view('err.customerNotFound');
61 61
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         Customers::find($id)->update($request->all());
91 91
 
92 92
         //  Modify to the new ID number if set
93
-        if(isset($request->cust_id))
93
+        if (isset($request->cust_id))
94 94
         {
95 95
             $id = $request->cust_id;
96 96
         }
Please login to merge, or discard this patch.
app/Exceptions/Handler.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      */
36 36
     public function report(Exception $exception)
37 37
     {
38
-        if(config('app.debug'))
38
+        if (config('app.debug'))
39 39
         {
40 40
             parent::report($exception);
41 41
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@
 block discarded – undo
38 38
         if(config('app.debug'))
39 39
         {
40 40
             parent::report($exception);
41
-        }
42
-        else
41
+        } else
43 42
         {
44 43
             Log::error('['.$exception->getCode().'] "'.$exception->getMessage().'" on line '.$exception->getTrace()[0]['line'].' of file '.$exception->getTrace()[0]['file']);
45 44
         }
Please login to merge, or discard this patch.
app/Http/Controllers/UserLinksController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
         $details = FileLinks::where('link_hash', $id)->first();
26 26
         
27 27
         //  Verify that the link is valid
28
-        if(empty($details))
28
+        if (empty($details))
29 29
         {
30 30
             return view('links.guest.badLink');
31 31
         }
32 32
         //  Verify that the link has not expired
33
-        else if($details->expire <= date('Y-m-d'))
33
+        else if ($details->expire<=date('Y-m-d'))
34 34
         {
35 35
             return view('links.guest.expiredLink');
36 36
         }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         
56 56
         $filePath = config('filesystems.paths.links').DIRECTORY_SEPARATOR.$details->link_id;
57 57
 
58
-        foreach($request->file as $file)
58
+        foreach ($request->file as $file)
59 59
         {
60 60
             //  Clean the file and store it
61 61
             $fileName = Files::cleanFilename($filePath, $file->getClientOriginalName());
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                 'upload' => 1
77 77
             ]);
78 78
             
79
-            if(!empty($request->note))
79
+            if (!empty($request->note))
80 80
             {
81 81
                 FileLinkNotes::create([
82 82
                     'link_id' => $details->link_id,
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         {
93 93
             Mail::to($user)->send(new NewLinkFile($details));
94 94
         }
95
-        catch(Exception $e)
95
+        catch (Exception $e)
96 96
         {
97 97
             report($e);
98 98
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,7 @@
 block discarded – undo
91 91
         try
92 92
         {
93 93
             Mail::to($user)->send(new NewLinkFile($details));
94
-        }
95
-        catch(Exception $e)
94
+        } catch(Exception $e)
96 95
         {
97 96
             report($e);
98 97
         }
Please login to merge, or discard this patch.
app/Http/Controllers/TechTipsController.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
             ->get();
36 36
         
37 37
         $sysArr = [];
38
-        foreach($systems as $sys)
38
+        foreach ($systems as $sys)
39 39
         {
40
-            foreach($sys->SystemTypes as $s)
40
+            foreach ($sys->SystemTypes as $s)
41 41
             {
42 42
                 $sysArr[$sys->name][$s->sys_id] = $s->name;
43 43
             }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public function search(Request $request)
53 53
     {
54 54
         //  Run different request based on if system field is filled out or not
55
-        if(!empty($request->system))
55
+        if (!empty($request->system))
56 56
         {
57 57
             $tipData = TechTips::where('subject', 'like', '%'.$request->tipSearch.'%')
58 58
                 ->whereHas('TechTipSystems', function($q) use($request)
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
             ->get();
82 82
         
83 83
         $sysArr = [];
84
-        foreach($systems as $sys)
84
+        foreach ($systems as $sys)
85 85
         {
86
-            foreach($sys->SystemTypes as $s)
86
+            foreach ($sys->SystemTypes as $s)
87 87
             {
88 88
                 $sysArr[$sys->name][$s->sys_id] = $s->name;
89 89
             }
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
         $tipID = $tip->tip_id;
109 109
 
110 110
         //  Enter all system tags associated with the tip
111
-        if(is_array($request->sysTags))
111
+        if (is_array($request->sysTags))
112 112
         {
113 113
             
114
-            foreach($request->sysTags as $tag)
114
+            foreach ($request->sysTags as $tag)
115 115
             {
116 116
                 TechTipSystems::create([
117 117
                     'tip_id' => $tipID,
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
         }
129 129
         
130 130
         //  If there are any files, process them
131
-        if(!empty($request->file))
131
+        if (!empty($request->file))
132 132
         {
133 133
             $filePath = config('filesystems.paths.tips').DIRECTORY_SEPARATOR.$tipID;
134
-            foreach($request->file as $file)
134
+            foreach ($request->file as $file)
135 135
             {
136 136
                 //  Clean the file and store it
137 137
                 $fileName = Files::cleanFilename($filePath, $file->getClientOriginalName());
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         {
160 160
             Mail::to($userList)->send(new newTechtip($tipData));
161 161
         }
162
-        catch(Exception $e)
162
+        catch (Exception $e)
163 163
         {
164 164
             report($e);
165 165
         }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     public function details($id, $name)
174 174
     {
175 175
         $tipData = TechTips::where('tip_id', $id)->with('user')->first();
176
-        if(empty($tipData))
176
+        if (empty($tipData))
177 177
         {
178 178
             return view('err.tipNotFound');
179 179
         }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     public function edit($id)
222 222
     {
223 223
         $tipData = TechTips::find($id);
224
-        if(empty($tipData))
224
+        if (empty($tipData))
225 225
         {
226 226
             return 'tip not found';
227 227
         }
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
             ->get();
245 245
         
246 246
         $sysArr = [];
247
-        foreach($systems as $sys)
247
+        foreach ($systems as $sys)
248 248
         {
249
-            foreach($sys->SystemTypes as $s)
249
+            foreach ($sys->SystemTypes as $s)
250 250
             {
251 251
                 $sysArr[$sys->name][$s->sys_id] = $s->name;
252 252
             }
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
         
276 276
         //  Enter all system tags associated with the tip after destroying the existing systems
277 277
         TechTipSystems::where('tip_id', $id)->delete();
278
-        if(is_array($request->sysTags))
278
+        if (is_array($request->sysTags))
279 279
         {
280 280
             
281
-            foreach($request->sysTags as $tag)
281
+            foreach ($request->sysTags as $tag)
282 282
             {
283 283
                 TechTipSystems::create([
284 284
                     'tip_id' => $id,
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
         
297 297
         //  Determine if any files were removed
298 298
         $tipFiles = TechTipFiles::where('tip_id', $id)->get();
299
-        if(!$tipFiles->isEmpty())
299
+        if (!$tipFiles->isEmpty())
300 300
         {
301
-            if(!empty($request->existingFile))
301
+            if (!empty($request->existingFile))
302 302
             {
303
-                foreach($tipFiles as $file)
303
+                foreach ($tipFiles as $file)
304 304
                 {
305
-                    if(!in_array($file->file_id, $request->existingFile))
305
+                    if (!in_array($file->file_id, $request->existingFile))
306 306
                     {
307 307
                         TechTipFiles::where('file_id', $file->file_id)->delete();
308 308
                         Files::deleteFile($file->file_id);
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
         }
318 318
         
319 319
         //  Process any new files
320
-        if(!empty($request->file))
320
+        if (!empty($request->file))
321 321
         {
322 322
             $filePath = config('filesystems.paths.tips').DIRECTORY_SEPARATOR.$id;
323
-            foreach($request->file as $file)
323
+            foreach ($request->file as $file)
324 324
             {
325 325
                 //  Clean the file and store it
326 326
                 $fileName = Files::cleanFilename($filePath, $file->getClientOriginalName());
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@  discard block
 block discarded – undo
60 60
                    $q->where('sys_id', $request->system);
61 61
                 })
62 62
                 ->get();
63
-        }
64
-        else
63
+        } else
65 64
         {
66 65
             $tipData = TechTips::where('subject', 'like', '%'.$request->tipSearch.'%')
67 66
                 ->get();
@@ -118,8 +117,7 @@  discard block
 block discarded – undo
118 117
                     'sys_id' => $tag
119 118
                 ]);
120 119
             }
121
-        }
122
-        else
120
+        } else
123 121
         {
124 122
             TechTipSystems::create([
125 123
                 'tip_id' => $tipID,
@@ -158,8 +156,7 @@  discard block
 block discarded – undo
158 156
         try
159 157
         {
160 158
             Mail::to($userList)->send(new newTechtip($tipData));
161
-        }
162
-        catch(Exception $e)
159
+        } catch(Exception $e)
163 160
         {
164 161
             report($e);
165 162
         }
@@ -285,8 +282,7 @@  discard block
 block discarded – undo
285 282
                     'sys_id' => $tag
286 283
                 ]);
287 284
             }
288
-        }
289
-        else
285
+        } else
290 286
         {
291 287
             TechTipSystems::create([
292 288
                 'tip_id' => $id,
@@ -308,8 +304,7 @@  discard block
 block discarded – undo
308 304
                         Files::deleteFile($file->file_id);
309 305
                     }
310 306
                 }
311
-            }
312
-            else
307
+            } else
313 308
             {
314 309
                 TechTipFiles::where('tip_id', $id)->delete();
315 310
             }
Please login to merge, or discard this patch.
app/Http/Controllers/UserController.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
         $roles = Role::all();
39 39
         
40 40
         $roleArr = [];
41
-        foreach($roles as $role)
41
+        foreach ($roles as $role)
42 42
         {
43
-            if($role->role_id == 1 && Auth::user()->role_id != 1)
43
+            if ($role->role_id == 1 && Auth::user()->role_id != 1)
44 44
             {
45 45
                 continue;
46 46
             }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         {
96 96
             Mail::to($request->email)->send(new InitializeUser($hash, $request->username, $request->first_name.' '.$request->last_name));
97 97
         }
98
-        catch(Exception $e)
98
+        catch (Exception $e)
99 99
         {
100 100
             report($e);
101 101
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         //  Validate the hash token
114 114
         $user = UserInitialize::where('token', $hash)->get();
115 115
         
116
-        if($user->isEmpty())
116
+        if ($user->isEmpty())
117 117
         {
118 118
             return abort(404);
119 119
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     {
127 127
         //  Verify that the link matches the assigned email address
128 128
         $valid = UserInitialize::where('token', $hash)->first();
129
-        if(empty($valid))
129
+        if (empty($valid))
130 130
         {
131 131
             return abort(404);
132 132
         }
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
         $userRole = DB::select('SELECT `role_id` FROM `user_role` WHERE `user_id` = ?', [$id])[0]->role_id;
199 199
         
200 200
         $roleArr = [];
201
-        foreach($roles as $role)
201
+        foreach ($roles as $role)
202 202
         {
203
-            if($role->role_id == 1 && Auth::user()->role_id != 1)
203
+            if ($role->role_id == 1 && Auth::user()->role_id != 1)
204 204
             {
205 205
                 continue;
206 206
             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
             if($role->role_id == 1 && Auth::user()->role_id != 1)
44 44
             {
45 45
                 continue;
46
-            }
47
-            else
46
+            } else
48 47
             {
49 48
                 $roleArr[$role->role_id] = $role->name;
50 49
             }
@@ -94,8 +93,7 @@  discard block
 block discarded – undo
94 93
         try
95 94
         {
96 95
             Mail::to($request->email)->send(new InitializeUser($hash, $request->username, $request->first_name.' '.$request->last_name));
97
-        }
98
-        catch(Exception $e)
96
+        } catch(Exception $e)
99 97
         {
100 98
             report($e);
101 99
         }
@@ -203,8 +201,7 @@  discard block
 block discarded – undo
203 201
             if($role->role_id == 1 && Auth::user()->role_id != 1)
204 202
             {
205 203
                 continue;
206
-            }
207
-            else
204
+            } else
208 205
             {
209 206
                 $roleArr[$role->role_id] = $role->name;
210 207
             }
Please login to merge, or discard this patch.