Passed
Push — dev5 ( 1f5b4d...1c738e )
by Ron
05:57
created
app/Http/Controllers/TechTips/TechTipsController.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         Log::debug('request Data -> ', $request->toArray());
64 64
 
65 65
         //  See if there are any search paramaters entered
66
-        if (!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) {
66
+        if(!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) {
67 67
             //  No search paramaters, send all tech tips
68 68
             $tips = new TechTipsCollection(
69 69
                 TechTips::orderBy('created_at', 'DESC')
@@ -72,21 +72,21 @@  discard block
 block discarded – undo
72 72
             );
73 73
         } else {
74 74
             $article = isset($request->search['articleType']) ? true : false;
75
-            $system  = isset($request->search['systemType'])  ? true : false;
75
+            $system  = isset($request->search['systemType']) ? true : false;
76 76
             //  Search paramaters, filter results
77 77
             $tips = new TechTipsCollection(
78 78
                 TechTips::orderBy('created_at', 'DESC')
79 79
                     //  Search by id or a phrase in the title or description
80
-                    ->where(function ($query) use ($request) {
81
-                        $query->where('subject', 'like', '%' . $request->search['searchText'] . '%')
82
-                            ->orWhere('tip_id', 'like', '%' . $request->search['searchText'] . '%')
83
-                            ->orWhere('description', 'like', '%' . $request->search['searchText'] . '%');
80
+                    ->where(function($query) use ($request) {
81
+                        $query->where('subject', 'like', '%'.$request->search['searchText'].'%')
82
+                            ->orWhere('tip_id', 'like', '%'.$request->search['searchText'].'%')
83
+                            ->orWhere('description', 'like', '%'.$request->search['searchText'].'%');
84 84
                     })
85
-                    ->when($article, function ($query) use ($request) {
85
+                    ->when($article, function($query) use ($request) {
86 86
                         $query->whereIn('tip_type_id', $request->search['articleType']);
87 87
                     })
88
-                    ->when($system, function ($query) use ($request) {
89
-                        $query->whereHas('SystemTypes', function ($query) use ($request) {
88
+                    ->when($system, function($query) use ($request) {
89
+                        $query->whereHas('SystemTypes', function($query) use ($request) {
90 90
                             $query->whereIn('system_types.sys_id', $request->search['systemType']);
91 91
                         });
92 92
                     })
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         $save = $receiver->receive();
159 159
 
160 160
         //  See if the uploade has finished
161
-        if ($save->isFinished()) {
161
+        if($save->isFinished()) {
162 162
             $this->saveFile($save->getFile());
163 163
 
164 164
             return 'uploaded successfully';
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
         //  Get the current progress
168 168
         $handler = $save->handler();
169 169
 
170
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
171
-        Log::debug('File being uploaded.  Percentage done - ' . $handler->getPercentageDone());
170
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
171
+        Log::debug('File being uploaded.  Percentage done - '.$handler->getPercentageDone());
172 172
         return response()->json([
173 173
             'done'   => $handler->getPercentageDone(),
174 174
             'status' => true
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         }
210 210
 
211 211
         //  Log stored file
212
-        Log::info('File Stored', ['file_id' => $fileID, 'file_path' => $filePath . DIRECTORY_SEPARATOR . $fileName]);
212
+        Log::info('File Stored', ['file_id' => $fileID, 'file_path' => $filePath.DIRECTORY_SEPARATOR.$fileName]);
213 213
         return $fileID;
214 214
     }
215 215
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     //  Details controller - will move to the show controller with just the tech tip id
280 280
     public function details($id, $subject)
281 281
     {
282
-        if (session()->has('newTipFile')) {
282
+        if(session()->has('newTipFile')) {
283 283
             session()->forget('newTipFile');
284 284
         }
285 285
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     //  Add or remove this tip as a favorite of the user
310 310
     public function toggleFav($action, $id)
311 311
     {
312
-        switch ($action) {
312
+        switch($action) {
313 313
             case 'add':
314 314
                 TechTipFavs::create([
315 315
                     'user_id' => Auth::user()->user_id,
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
                 break;
323 323
         }
324 324
 
325
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
325
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
326 326
         Log::debug('Tech Tip Bookmark Updated.', [
327 327
             'user_id' => Auth::user()->user_id,
328 328
             'tip_id' => $id,
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         $this->authorize('hasAccess', 'edit_tech_tip');
338 338
         $tipData = TechTips::where('tip_id', $id)->with('User')->with('SystemTypes')->with('TechTipTypes')->first();
339 339
 
340
-        if (!$tipData) {
340
+        if(!$tipData) {
341 341
             return view('tips.tipNotFound');
342 342
         }
343 343
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
         $systemsArr = new SystemCategoriesCollection(SystemCategories::with('SystemTypes')->get());
346 346
         $files = TechTipFiles::where('tip_id', $id)->with('Files')->get();
347 347
 
348
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
348
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
349 349
         return view('tips.editTip', [
350 350
             'tipTypes' => $typesArr,
351 351
             'sysTypes' => $systemsArr,
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
         $receiver = new FileReceiver('file', $request, HandlerFactory::classFromRequest($request));
371 371
 
372 372
         //  Verify if there is a file to be processed or not
373
-        if ($receiver->isUploaded() === false || $request->_completed) {
373
+        if($receiver->isUploaded() === false || $request->_completed) {
374 374
             $this->storeUpdatedTip($request, $id);
375
-            Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
375
+            Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
376 376
             return response()->json(['tip_id' => $id]);
377 377
         }
378 378
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         $save = $receiver->receive();
381 381
 
382 382
         //  See if the uploade has finished
383
-        if ($save->isFinished()) {
383
+        if($save->isFinished()) {
384 384
             $this->saveFile($save->getFile(), $id);
385 385
 
386 386
             return 'uploaded successfully';
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
         //  Get the current progress
390 390
         $handler = $save->handler();
391 391
 
392
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
393
-        Log::debug('File being uploaded.  Percentage done - ' . $handler->getPercentageDone());
392
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
393
+        Log::debug('File being uploaded.  Percentage done - '.$handler->getPercentageDone());
394 394
         return response()->json([
395 395
             'done'   => $handler->getPercentageDone(),
396 396
             'status' => true
Please login to merge, or discard this patch.
Braces   +18 added lines, -10 removed lines patch added patch discarded remove patch
@@ -63,14 +63,17 @@  discard block
 block discarded – undo
63 63
         Log::debug('request Data -> ', $request->toArray());
64 64
 
65 65
         //  See if there are any search paramaters entered
66
-        if (!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) {
66
+        if (!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType']))
67
+        {
67 68
             //  No search paramaters, send all tech tips
68 69
             $tips = new TechTipsCollection(
69 70
                 TechTips::orderBy('created_at', 'DESC')
70 71
                     ->with('SystemTypes')
71 72
                     ->paginate($request->pagination['perPage'])
72 73
             );
73
-        } else {
74
+        }
75
+        else
76
+        {
74 77
             $article = isset($request->search['articleType']) ? true : false;
75 78
             $system  = isset($request->search['systemType'])  ? true : false;
76 79
             //  Search paramaters, filter results
@@ -158,7 +161,8 @@  discard block
 block discarded – undo
158 161
         $save = $receiver->receive();
159 162
 
160 163
         //  See if the uploade has finished
161
-        if ($save->isFinished()) {
164
+        if ($save->isFinished())
165
+        {
162 166
             $this->saveFile($save->getFile());
163 167
 
164 168
             return 'uploaded successfully';
@@ -264,8 +268,7 @@  discard block
 block discarded – undo
264 268
         if(!$tipData->supressEmail)
265 269
         {
266 270
             $details = TechTips::find($tipID);
267
-            $users = User::where('active', 1)->whereHas('UserSettings', function($query)
268
-            {
271
+            $users = User::where('active', 1)->whereHas('UserSettings', function($query) {
269 272
                 $query->where('em_tech_tip', 1);
270 273
             })->get();
271 274
 
@@ -279,7 +282,8 @@  discard block
 block discarded – undo
279 282
     //  Details controller - will move to the show controller with just the tech tip id
280 283
     public function details($id, $subject)
281 284
     {
282
-        if (session()->has('newTipFile')) {
285
+        if (session()->has('newTipFile'))
286
+        {
283 287
             session()->forget('newTipFile');
284 288
         }
285 289
 
@@ -309,7 +313,8 @@  discard block
 block discarded – undo
309 313
     //  Add or remove this tip as a favorite of the user
310 314
     public function toggleFav($action, $id)
311 315
     {
312
-        switch ($action) {
316
+        switch ($action)
317
+        {
313 318
             case 'add':
314 319
                 TechTipFavs::create([
315 320
                     'user_id' => Auth::user()->user_id,
@@ -337,7 +342,8 @@  discard block
 block discarded – undo
337 342
         $this->authorize('hasAccess', 'edit_tech_tip');
338 343
         $tipData = TechTips::where('tip_id', $id)->with('User')->with('SystemTypes')->with('TechTipTypes')->first();
339 344
 
340
-        if (!$tipData) {
345
+        if (!$tipData)
346
+        {
341 347
             return view('tips.tipNotFound');
342 348
         }
343 349
 
@@ -370,7 +376,8 @@  discard block
 block discarded – undo
370 376
         $receiver = new FileReceiver('file', $request, HandlerFactory::classFromRequest($request));
371 377
 
372 378
         //  Verify if there is a file to be processed or not
373
-        if ($receiver->isUploaded() === false || $request->_completed) {
379
+        if ($receiver->isUploaded() === false || $request->_completed)
380
+        {
374 381
             $this->storeUpdatedTip($request, $id);
375 382
             Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
376 383
             return response()->json(['tip_id' => $id]);
@@ -380,7 +387,8 @@  discard block
 block discarded – undo
380 387
         $save = $receiver->receive();
381 388
 
382 389
         //  See if the uploade has finished
383
-        if ($save->isFinished()) {
390
+        if ($save->isFinished())
391
+        {
384 392
             $this->saveFile($save->getFile(), $id);
385 393
 
386 394
             return 'uploaded successfully';
Please login to merge, or discard this patch.
database/factories/TechTipFilesFactory.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\TechTipFiles;
6 6
 use Faker\Generator as Faker;
7 7
 
8
-$factory->define(TechTipFiles::class, function (Faker $faker) {
8
+$factory->define(TechTipFiles::class, function(Faker $faker) {
9 9
     return [
10 10
         //
11 11
         'tip_id' => factory(App\TechTips::class)->create()->tip_id,
Please login to merge, or discard this patch.
routes/web.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -8,58 +8,58 @@  discard block
 block discarded – undo
8 8
 /*
9 9
 *   Non user Routes
10 10
 */
11
-Route::get('/',         'Auth\LoginController@showLoginForm')->name('index');
12
-Route::get('logout',    'Auth\LoginController@logout')       ->name('logout');
11
+Route::get('/', 'Auth\LoginController@showLoginForm')->name('index');
12
+Route::get('logout', 'Auth\LoginController@logout')       ->name('logout');
13 13
 Route::get('no-script', 'Controller@noScript')               ->name('noscript');
14 14
 
15 15
 
16 16
 /*
17 17
 *   Download File Routes
18 18
 */
19
-Route::get('download/{id}/{filename}',    'DownloadController@index')          ->name('download');
19
+Route::get('download/{id}/{filename}', 'DownloadController@index')          ->name('download');
20 20
 Route::get('download-archive/{filename}', 'DownloadController@downloadArchive')->name('downloadArchive');
21
-Route::put('download-archive',            'DownloadController@archiveFiles')   ->name('archiveFiles');
21
+Route::put('download-archive', 'DownloadController@archiveFiles')   ->name('archiveFiles');
22 22
 
23 23
 
24 24
 /*
25 25
 *   User Settings Routes
26 26
 */
27
-Route::get('account',                   'AccountController@index')         ->name('account');
28
-Route::post('account',                  'AccountController@submit')        ->name('account');
29
-Route::put('account',                   'AccountController@notifications') ->name('account');
30
-Route::get('/account/change-password',  'AccountController@changePassword')->name('changePassword');
27
+Route::get('account', 'AccountController@index')         ->name('account');
28
+Route::post('account', 'AccountController@submit')        ->name('account');
29
+Route::put('account', 'AccountController@notifications') ->name('account');
30
+Route::get('/account/change-password', 'AccountController@changePassword')->name('changePassword');
31 31
 Route::post('/account/change-password', 'AccountController@submitPassword')->name('changePassword');
32 32
 
33 33
 /*
34 34
 *   Basic Logged In Routes
35 35
 */
36
-Route::get('about',     'DashboardController@about')->name('about');
36
+Route::get('about', 'DashboardController@about')->name('about');
37 37
 Route::get('dashboard', 'DashboardController@index')->name('dashboard');
38 38
 
39 39
 /*
40 40
 *   File Link Routes
41 41
 */
42
-Route::prefix('links')->name('links.')->group(function () {
42
+Route::prefix('links')->name('links.')->group(function() {
43 43
     //  Resource controllers for base access
44
-    Route::resource('data',           'FileLinks\FileLinksController');
45
-    Route::get('new',                 'FileLinks\FileLinksController@create')     ->name('new');
46
-    Route::get('find/{id}',           'FileLinks\FileLinksController@find')       ->name('user');
44
+    Route::resource('data', 'FileLinks\FileLinksController');
45
+    Route::get('new', 'FileLinks\FileLinksController@create')     ->name('new');
46
+    Route::get('find/{id}', 'FileLinks\FileLinksController@find')       ->name('user');
47 47
     Route::get('details/{id}/{name}', 'FileLinks\FileLinksController@details')    ->name('details');
48
-    Route::get('disable/{id}',        'FileLinks\FileLinksController@disableLink')->name('disable');
48
+    Route::get('disable/{id}', 'FileLinks\FileLinksController@disableLink')->name('disable');
49 49
     //  File Link Files
50
-    Route::resource('files',          'FileLinks\LinkFilesController');
50
+    Route::resource('files', 'FileLinks\LinkFilesController');
51 51
     //  Index landing page
52
-    Route::get('/',                   'FileLinks\FileLinksController@index')      ->name('index');
52
+    Route::get('/', 'FileLinks\FileLinksController@index')      ->name('index');
53 53
 });
54 54
 
55 55
 /*
56 56
 *   Guest File Link Routes
57 57
 */
58 58
 Route::get('file-links/{id}/get-files', 'FileLinks\GuestLinksController@getFiles')->name('file-links.getFiles');
59
-Route::put('file-links/{id}',           'FileLinks\GuestLinksController@notify')  ->name('file-links.show');
60
-Route::post('file-links/{id}',          'FileLinks\GuestLinksController@update')  ->name('file-links.show');
61
-Route::get('file-links/{id}',           'FileLinks\GuestLinksController@show')    ->name('file-links.show');
62
-Route::get('file-links',                'FileLinks\GuestLinksController@index')   ->name('file-links.index');
59
+Route::put('file-links/{id}', 'FileLinks\GuestLinksController@notify')  ->name('file-links.show');
60
+Route::post('file-links/{id}', 'FileLinks\GuestLinksController@update')  ->name('file-links.show');
61
+Route::get('file-links/{id}', 'FileLinks\GuestLinksController@show')    ->name('file-links.show');
62
+Route::get('file-links', 'FileLinks\GuestLinksController@index')   ->name('file-links.index');
63 63
 
64 64
 /*
65 65
 *   Customer Routes
@@ -67,39 +67,39 @@  discard block
 block discarded – undo
67 67
 Route::prefix('customer')->name('customer.')->group(function()
68 68
 {
69 69
     //  Customer Files
70
-    Route::resource('files',                   'Customers\CustomerFilesController');
70
+    Route::resource('files', 'Customers\CustomerFilesController');
71 71
     //  Custome Notes
72
-    Route::get('download-note/{id}',           'DownloadController@downloadCustNote')        ->name('download-note');
73
-    Route::resource('notes',                   'Customers\CustomerNotesController');
72
+    Route::get('download-note/{id}', 'DownloadController@downloadCustNote')        ->name('download-note');
73
+    Route::resource('notes', 'Customers\CustomerNotesController');
74 74
     //  Customer Contacts
75
-    Route::resource('contacts',                'Customers\CustomerContactsController');
75
+    Route::resource('contacts', 'Customers\CustomerContactsController');
76 76
     //  Customer Systems
77
-    Route::resource('systems',                 'Customers\CustomerSystemsController');
77
+    Route::resource('systems', 'Customers\CustomerSystemsController');
78 78
     //  Customer Details
79
-    Route::get('id/{id}/{name}',               'Customers\CustomerDetailsController@details')->name('details');
80
-    Route::resource('id',                      'Customers\CustomerDetailsController');
79
+    Route::get('id/{id}/{name}', 'Customers\CustomerDetailsController@details')->name('details');
80
+    Route::resource('id', 'Customers\CustomerDetailsController');
81 81
     //  check Id and bookmark customer
82 82
     Route::get('toggle-fav/{action}/{custID}', 'Customers\CustomerController@toggleFav')     ->name('toggle-fav');
83
-    Route::get('check-id/{id}',                'Customers\CustomerController@checkID')       ->name('check-id');
83
+    Route::get('check-id/{id}', 'Customers\CustomerController@checkID')       ->name('check-id');
84 84
     //  Index landing/search page
85
-    Route::get('search',                       'Customers\CustomerController@search')        ->name('search');
86
-    Route::get('/',                            'Customers\CustomerController@index')         ->name('index');
85
+    Route::get('search', 'Customers\CustomerController@search')        ->name('search');
86
+    Route::get('/', 'Customers\CustomerController@index')         ->name('index');
87 87
 });
88 88
 
89 89
 
90 90
 /*
91 91
 *   Tech Tip Routes
92 92
 */
93
-Route::resource('tips',                       'TechTips\TechTipsController');
93
+Route::resource('tips', 'TechTips\TechTipsController');
94 94
 Route::post('submit-edit/{id}', 'TechTips\TechTipsController@update')->name('tips.submit-edit');
95 95
 Route::prefix('tip')->name('tip.')->group(function()
96 96
 {
97
-    Route::resource('comments',               'TechTips\TechTipCommentsController');
98
-    Route::get('search',                      'TechTips\TechTipsController@search')      ->name('search');
99
-    Route::get('details/{id}/{name}',         'TechTips\TechTipsController@details')     ->name('details');
100
-    Route::post('process-image',              'TechTips\TechTipsController@processImage')->name('processImage');
97
+    Route::resource('comments', 'TechTips\TechTipCommentsController');
98
+    Route::get('search', 'TechTips\TechTipsController@search')      ->name('search');
99
+    Route::get('details/{id}/{name}', 'TechTips\TechTipsController@details')     ->name('details');
100
+    Route::post('process-image', 'TechTips\TechTipsController@processImage')->name('processImage');
101 101
     Route::get('toggle-fav/{action}/{tipID}', 'TechTips\TechTipsController@toggleFav')   ->name('toggle-fav');
102
-    Route::get('download-tip/{id}',           'DownloadController@downloadTechTip')      ->name('downloadTip');
102
+    Route::get('download-tip/{id}', 'DownloadController@downloadTechTip')      ->name('downloadTip');
103 103
 });
104 104
 
105 105
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,8 +64,7 @@  discard block
 block discarded – undo
64 64
 /*
65 65
 *   Customer Routes
66 66
 */
67
-Route::prefix('customer')->name('customer.')->group(function()
68
-{
67
+Route::prefix('customer')->name('customer.')->group(function() {
69 68
     //  Customer Files
70 69
     Route::resource('files',                   'Customers\CustomerFilesController');
71 70
     //  Custome Notes
@@ -92,8 +91,7 @@  discard block
 block discarded – undo
92 91
 */
93 92
 Route::resource('tips',                       'TechTips\TechTipsController');
94 93
 Route::post('submit-edit/{id}', 'TechTips\TechTipsController@update')->name('tips.submit-edit');
95
-Route::prefix('tip')->name('tip.')->group(function()
96
-{
94
+Route::prefix('tip')->name('tip.')->group(function() {
97 95
     Route::resource('comments',               'TechTips\TechTipCommentsController');
98 96
     Route::get('search',                      'TechTips\TechTipsController@search')      ->name('search');
99 97
     Route::get('details/{id}/{name}',         'TechTips\TechTipsController@details')     ->name('details');
Please login to merge, or discard this patch.