@@ -100,7 +100,8 @@ discard block |
||
100 | 100 | |
101 | 101 | // Determine if there is a parent site with shared files |
102 | 102 | $parent = Customers::find($id)->parent_id; |
103 | - if($parent) { |
|
103 | + if($parent) |
|
104 | + { |
|
104 | 105 | $parentList = Customerfiles::where('cust_id', $parent) |
105 | 106 | ->where('shared', 1) |
106 | 107 | ->with('Files') |
@@ -126,7 +127,8 @@ discard block |
||
126 | 127 | ]); |
127 | 128 | |
128 | 129 | $details = Customers::find($request->cust_id); |
129 | - if($details->parent_id && $request->shared == 1) { |
|
130 | + if($details->parent_id && $request->shared == 1) |
|
131 | + { |
|
130 | 132 | $request->cust_id = $details->parent_id; |
131 | 133 | } |
132 | 134 |
@@ -53,14 +53,17 @@ discard block |
||
53 | 53 | Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data - ', $request->toArray()); |
54 | 54 | |
55 | 55 | // See if there are any search paramaters entered |
56 | - if(!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) { |
|
56 | + if(!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) |
|
57 | + { |
|
57 | 58 | // No search paramaters, send all tech tips |
58 | 59 | $tips = new TechTipsCollection( |
59 | 60 | TechTips::orderBy('created_at', 'DESC') |
60 | 61 | ->with('SystemTypes') |
61 | 62 | ->paginate($request->pagination['perPage']) |
62 | 63 | ); |
63 | - } else { |
|
64 | + } |
|
65 | + else |
|
66 | + { |
|
64 | 67 | $article = isset($request->search['articleType']) ? true : false; |
65 | 68 | $system = isset($request->search['systemType']) ? true : false; |
66 | 69 | // Search paramaters, filter results |
@@ -151,7 +154,8 @@ discard block |
||
151 | 154 | $save = $receiver->receive(); |
152 | 155 | |
153 | 156 | // See if the uploade has finished |
154 | - if($save->isFinished()) { |
|
157 | + if($save->isFinished()) |
|
158 | + { |
|
155 | 159 | $this->saveFile($save->getFile()); |
156 | 160 | |
157 | 161 | return 'uploaded successfully'; |
@@ -266,7 +270,8 @@ discard block |
||
266 | 270 | // Details controller - will move to the show controller with just the tech tip id |
267 | 271 | public function details($id, $subject) |
268 | 272 | { |
269 | - if(session()->has('newTipFile')) { |
|
273 | + if(session()->has('newTipFile')) |
|
274 | + { |
|
270 | 275 | session()->forget('newTipFile'); |
271 | 276 | } |
272 | 277 | |
@@ -300,7 +305,8 @@ discard block |
||
300 | 305 | { |
301 | 306 | Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
302 | 307 | |
303 | - switch($action) { |
|
308 | + switch($action) |
|
309 | + { |
|
304 | 310 | case 'add': |
305 | 311 | TechTipFavs::create([ |
306 | 312 | 'user_id' => Auth::user()->user_id, |
@@ -329,7 +335,8 @@ discard block |
||
329 | 335 | $this->authorize('hasAccess', 'Edit Tech Tip'); |
330 | 336 | $tipData = TechTips::where('tip_id', $id)->with('User')->with('SystemTypes')->with('TechTipTypes')->first(); |
331 | 337 | |
332 | - if(!$tipData) { |
|
338 | + if(!$tipData) |
|
339 | + { |
|
333 | 340 | return view('tips.tipNotFound'); |
334 | 341 | } |
335 | 342 | |
@@ -362,7 +369,8 @@ discard block |
||
362 | 369 | $receiver = new FileReceiver('file', $request, HandlerFactory::classFromRequest($request)); |
363 | 370 | |
364 | 371 | // Verify if there is a file to be processed or not |
365 | - if($receiver->isUploaded() === false || $request->_completed) { |
|
372 | + if($receiver->isUploaded() === false || $request->_completed) |
|
373 | + { |
|
366 | 374 | $this->storeUpdatedTip($request, $id); |
367 | 375 | Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
368 | 376 | return response()->json(['tip_id' => $id]); |
@@ -372,7 +380,8 @@ discard block |
||
372 | 380 | $save = $receiver->receive(); |
373 | 381 | |
374 | 382 | // See if the uploade has finished |
375 | - if($save->isFinished()) { |
|
383 | + if($save->isFinished()) |
|
384 | + { |
|
376 | 385 | $this->saveFile($save->getFile(), $id); |
377 | 386 | |
378 | 387 | return 'uploaded successfully'; |
@@ -204,6 +204,10 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | // Create the tech tip |
207 | + |
|
208 | + /** |
|
209 | + * @param Request $tipData |
|
210 | + */ |
|
207 | 211 | private function createTip($tipData) |
208 | 212 | { |
209 | 213 | // Remove any forward slash (/) from the Subject Field |
@@ -389,6 +393,10 @@ discard block |
||
389 | 393 | } |
390 | 394 | |
391 | 395 | // Store the updated tip |
396 | + |
|
397 | + /** |
|
398 | + * @param Request $tipData |
|
399 | + */ |
|
392 | 400 | public function storeUpdatedTip($tipData, $id) |
393 | 401 | { |
394 | 402 | $this->authorize('hasAccess', 'Edit Tech Tip'); |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | ]; |
42 | 42 | } |
43 | 43 | $mods = Module::allDisabled(); |
44 | - foreach($mods as $name => $mod) { |
|
44 | + foreach($mods as $name => $mod) |
|
45 | + { |
|
45 | 46 | $moduleList[] = [ |
46 | 47 | 'name' => $name, |
47 | 48 | 'status' => 'Disabled', |
@@ -78,7 +79,8 @@ discard block |
||
78 | 79 | $receiver = new FileReceiver('file', $request, HandlerFactory::classFromRequest($request)); |
79 | 80 | |
80 | 81 | // Verify that the upload is valid and being processed |
81 | - if($receiver->isUploaded() === false) { |
|
82 | + if($receiver->isUploaded() === false) |
|
83 | + { |
|
82 | 84 | Log::error('Upload File Missing - '. |
83 | 85 | /** @scrutinizer ignore-type */ |
84 | 86 | $request->toArray()); |
@@ -89,7 +91,8 @@ discard block |
||
89 | 91 | $save = $receiver->receive(); |
90 | 92 | |
91 | 93 | // See if the uploade has finished |
92 | - if($save->isFinished()) { |
|
94 | + if($save->isFinished()) |
|
95 | + { |
|
93 | 96 | $this->saveFile($save->getFile()); |
94 | 97 | |
95 | 98 | return 'uploaded successfully'; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | ]); |
81 | 81 | |
82 | 82 | // Update the site timezone |
83 | - if (config('app.timezone') !== $request->timezone) |
|
83 | + if(config('app.timezone') !== $request->timezone) |
|
84 | 84 | { |
85 | 85 | Settings::firstOrCreate( |
86 | 86 | ['key' => 'app.timezone'], |
@@ -88,7 +88,7 @@ discard block |
||
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 | { |
93 | 93 | Settings::firstOrCreate( |
94 | 94 | ['key' => 'filesystems.paths.max_size'], |
@@ -211,7 +211,8 @@ |
||
211 | 211 | public function destroy($id) |
212 | 212 | { |
213 | 213 | // |
214 | - try { |
|
214 | + try |
|
215 | + { |
|
215 | 216 | SystemTypes::find($id)->delete(); |
216 | 217 | return response()->json(['success' => true, 'reason' => 'Equipment Successfully Deleted']); |
217 | 218 | } |
@@ -59,9 +59,12 @@ discard block |
||
59 | 59 | public function archiveFiles(Request $request) |
60 | 60 | { |
61 | 61 | // Debug Data |
62 | - if(Auth::user()) { |
|
62 | + if(Auth::user()) |
|
63 | + { |
|
63 | 64 | $user = Auth::user()->full_name; |
64 | - } else { |
|
65 | + } |
|
66 | + else |
|
67 | + { |
|
65 | 68 | $user = \Request::ip(); |
66 | 69 | } |
67 | 70 | Log::debug('Route '.Route::currentRouteName().' visited by '.$user.' Request Data:', $request->toArray()); |
@@ -107,9 +110,12 @@ discard block |
||
107 | 110 | public function downloadArchive($fileName) |
108 | 111 | { |
109 | 112 | // Debug Data |
110 | - if(Auth::user()) { |
|
113 | + if(Auth::user()) |
|
114 | + { |
|
111 | 115 | $user = Auth::user()->full_name; |
112 | - } else { |
|
116 | + } |
|
117 | + else |
|
118 | + { |
|
113 | 119 | $user = \Request::ip(); |
114 | 120 | } |
115 | 121 | Log::debug('Route '.Route::currentRouteName().' visited by '.$user); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | Log::debug('Preparing to clean a file. Current Name - '.$fileName.'. Current Path - '.$path); |
20 | 20 | // Remove all spaces |
21 | 21 | $fileName = str_replace(' ', '_', $fileName); |
22 | - Log::debug('Cleaned Filename. Current Name - ' . $fileName . '. Current Path - ' . $path); |
|
22 | + Log::debug('Cleaned Filename. Current Name - '.$fileName.'. Current Path - '.$path); |
|
23 | 23 | |
24 | 24 | // Determine if the filename already exists |
25 | 25 | if(Storage::exists($path.DIRECTORY_SEPARATOR.$fileName)) |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // Increase the number until one that is not in use is found |
45 | 45 | do |
46 | 46 | { |
47 | - Log::debug('Filename ' . $fileName . ' already exists. Appending name.'); |
|
47 | + Log::debug('Filename '.$fileName.' already exists. Appending name.'); |
|
48 | 48 | $fileName = $base.'('.++$number.')'.$extension; |
49 | 49 | } while(Storage::exists($path.DIRECTORY_SEPARATOR.$fileName)); |
50 | 50 | } |
@@ -14,6 +14,12 @@ |
||
14 | 14 | protected $hidden = ['created_at', 'updated_at', 'file_link']; |
15 | 15 | |
16 | 16 | // Remove any illegal characters from filename and make sure it is unique |
17 | + |
|
18 | + /** |
|
19 | + * @param string $path |
|
20 | + * |
|
21 | + * @return string |
|
22 | + */ |
|
17 | 23 | public static function cleanFileName($path, $fileName) |
18 | 24 | { |
19 | 25 | Log::debug('Preparing to clean a file. Current Name - '.$fileName.'. Current Path - '.$path); |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | // Dashboard is the Logged In User home landing page |
23 | 23 | public function index() |
24 | 24 | { |
25 | - Log::debug('Route "' . Route::currentRouteName() . '" visited by ' . Auth::user()->full_name); |
|
25 | + Log::debug('Route "'.Route::currentRouteName().'" visited by '.Auth::user()->full_name); |
|
26 | 26 | |
27 | 27 | // Get Dashboard data |
28 | - $custFavs = CustomerFavs::where('user_id', Auth::user()->user_id) |
|
29 | - ->with(array('Customers' => function($query){ |
|
28 | + $custFavs = CustomerFavs::where('user_id', Auth::user()->user_id) |
|
29 | + ->with(array('Customers' => function($query) { |
|
30 | 30 | $query->select('cust_id', 'name'); |
31 | 31 | })) |
32 | 32 | ->get(); |
33 | - $tipFavs = TechTipFavs::where('user_id', Auth::user()->user_id) |
|
34 | - ->with(array('TechTips' => function($query){ |
|
33 | + $tipFavs = TechTipFavs::where('user_id', Auth::user()->user_id) |
|
34 | + ->with(array('TechTips' => function($query) { |
|
35 | 35 | $query->select('tip_id', 'subject'); |
36 | 36 | })) |
37 | 37 | ->get(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // Mark a notification as read |
68 | 68 | public function markNotification($id) |
69 | 69 | { |
70 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
70 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
71 | 71 | |
72 | 72 | $notification = Auth::user()->notifications()->where('id', $id)->where('notifiable_id', Auth::user()->user_id)->first(); |
73 | 73 | if(!$notification) |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | // Delte a user notification |
86 | 86 | public function delNotification($id) |
87 | 87 | { |
88 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
88 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
89 | 89 | |
90 | 90 | $notification = Auth::user()->notifications()->where('id', $id)->where('notifiable_id', Auth::user()->user_id)->first(); |
91 | 91 | if(!$notification) |
92 | 92 | { |
93 | - Log::error('User ' . Auth::user()->full_name . ' tried to delete an invalid notification. Notification ID: ' . $id); |
|
93 | + Log::error('User '.Auth::user()->full_name.' tried to delete an invalid notification. Notification ID: '.$id); |
|
94 | 94 | return abort(404); |
95 | 95 | } |
96 | 96 |
@@ -26,12 +26,12 @@ |
||
26 | 26 | |
27 | 27 | // Get Dashboard data |
28 | 28 | $custFavs = CustomerFavs::where('user_id', Auth::user()->user_id) |
29 | - ->with(array('Customers' => function($query){ |
|
29 | + ->with(array('Customers' => function($query) { |
|
30 | 30 | $query->select('cust_id', 'name'); |
31 | 31 | })) |
32 | 32 | ->get(); |
33 | 33 | $tipFavs = TechTipFavs::where('user_id', Auth::user()->user_id) |
34 | - ->with(array('TechTips' => function($query){ |
|
34 | + ->with(array('TechTips' => function($query) { |
|
35 | 35 | $query->select('tip_id', 'subject'); |
36 | 36 | })) |
37 | 37 | ->get(); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | // Show the files attached to a link |
90 | 90 | public function show($id) |
91 | 91 | { |
92 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
92 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
93 | 93 | |
94 | 94 | $files = new FileLinkFilesCollection( |
95 | 95 | FileLinkFiles::where('link_id', $id) |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | // Delete a file attached to a link |
161 | 161 | public function destroy($id) |
162 | 162 | { |
163 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
163 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
164 | 164 | Log::debug('Submitted File ID to be deleted - '.$id); |
165 | 165 | |
166 | 166 | // Get the necessary file information and delete it from the database |