@@ -48,12 +48,12 @@  | 
                                                    ||
| 48 | 48 |          $totalLinks  = FileLinks::where('user_id', Auth::user()->user_id)->count(); | 
                                                        
| 49 | 49 | |
| 50 | 50 |          return view('dashboard', [ | 
                                                        
| 51 | - 'custFavs' => $custFavs,  | 
                                                        |
| 52 | - 'tipFavs' => $tipFavs,  | 
                                                        |
| 53 | - 'tips30' => $tips30Days,  | 
                                                        |
| 54 | - 'tipsAll' => $tipsTotal,  | 
                                                        |
| 55 | - 'activeLinks' => $activeLinks,  | 
                                                        |
| 56 | - 'totalLinks' => $totalLinks,  | 
                                                        |
| 51 | + 'custFavs' => $custFavs,  | 
                                                        |
| 52 | + 'tipFavs' => $tipFavs,  | 
                                                        |
| 53 | + 'tips30' => $tips30Days,  | 
                                                        |
| 54 | + 'tipsAll' => $tipsTotal,  | 
                                                        |
| 55 | + 'activeLinks' => $activeLinks,  | 
                                                        |
| 56 | + 'totalLinks' => $totalLinks,  | 
                                                        |
| 57 | 57 | // 'modules' => $modules  | 
                                                        
| 58 | 58 | ]);  | 
                                                        
| 59 | 59 | }  | 
                                                        
@@ -51,7 +51,7 @@ discard block  | 
                                                    ||
| 51 | 51 |          Log::debug('request Data -> ', $request->toArray()); | 
                                                        
| 52 | 52 | |
| 53 | 53 | // See if there are any search paramaters entered  | 
                                                        
| 54 | -        if (!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) { | 
                                                        |
| 54 | +        if(!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) { | 
                                                        |
| 55 | 55 | // No search paramaters, send all tech tips  | 
                                                        
| 56 | 56 | $tips = new TechTipsCollection(  | 
                                                        
| 57 | 57 |                  TechTips::orderBy('created_at', 'DESC') | 
                                                        
@@ -60,21 +60,21 @@ discard block  | 
                                                    ||
| 60 | 60 | );  | 
                                                        
| 61 | 61 |          } else { | 
                                                        
| 62 | 62 | $article = isset($request->search['articleType']) ? true : false;  | 
                                                        
| 63 | - $system = isset($request->search['systemType']) ? true : false;  | 
                                                        |
| 63 | + $system = isset($request->search['systemType']) ? true : false;  | 
                                                        |
| 64 | 64 | // Search paramaters, filter results  | 
                                                        
| 65 | 65 | $tips = new TechTipsCollection(  | 
                                                        
| 66 | 66 |                  TechTips::orderBy('created_at', 'DESC') | 
                                                        
| 67 | 67 | // Search by id or a phrase in the title or description  | 
                                                        
| 68 | -                    ->where(function ($query) use ($request) { | 
                                                        |
| 69 | -                        $query->where('subject', 'like', '%' . $request->search['searchText'] . '%') | 
                                                        |
| 70 | -                            ->orWhere('tip_id', 'like', '%' . $request->search['searchText'] . '%') | 
                                                        |
| 71 | -                            ->orWhere('description', 'like', '%' . $request->search['searchText'] . '%'); | 
                                                        |
| 68 | +                    ->where(function($query) use ($request) { | 
                                                        |
| 69 | +                        $query->where('subject', 'like', '%'.$request->search['searchText'].'%') | 
                                                        |
| 70 | +                            ->orWhere('tip_id', 'like', '%'.$request->search['searchText'].'%') | 
                                                        |
| 71 | +                            ->orWhere('description', 'like', '%'.$request->search['searchText'].'%'); | 
                                                        |
| 72 | 72 | })  | 
                                                        
| 73 | -                    ->when($article, function ($query) use ($request) { | 
                                                        |
| 73 | +                    ->when($article, function($query) use ($request) { | 
                                                        |
| 74 | 74 |                          $query->whereIn('tip_type_id', $request->search['articleType']); | 
                                                        
| 75 | 75 | })  | 
                                                        
| 76 | -                    ->when($system, function ($query) use ($request) { | 
                                                        |
| 77 | -                        $query->whereHas('SystemTypes', function ($query) use ($request) { | 
                                                        |
| 76 | +                    ->when($system, function($query) use ($request) { | 
                                                        |
| 77 | +                        $query->whereHas('SystemTypes', function($query) use ($request) { | 
                                                        |
| 78 | 78 |                              $query->whereIn('system_types.sys_id', $request->search['systemType']); | 
                                                        
| 79 | 79 | });  | 
                                                        
| 80 | 80 | })  | 
                                                        
@@ -146,7 +146,7 @@ discard block  | 
                                                    ||
| 146 | 146 | $save = $receiver->receive();  | 
                                                        
| 147 | 147 | |
| 148 | 148 | // See if the uploade has finished  | 
                                                        
| 149 | -        if ($save->isFinished()) { | 
                                                        |
| 149 | +        if($save->isFinished()) { | 
                                                        |
| 150 | 150 | $this->saveFile($save->getFile());  | 
                                                        
| 151 | 151 | |
| 152 | 152 | return 'uploaded successfully';  | 
                                                        
@@ -155,8 +155,8 @@ discard block  | 
                                                    ||
| 155 | 155 | // Get the current progress  | 
                                                        
| 156 | 156 | $handler = $save->handler();  | 
                                                        
| 157 | 157 | |
| 158 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); | 
                                                        |
| 159 | -        Log::debug('File being uploaded.  Percentage done - ' . $handler->getPercentageDone()); | 
                                                        |
| 158 | +        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); | 
                                                        |
| 159 | +        Log::debug('File being uploaded.  Percentage done - '.$handler->getPercentageDone()); | 
                                                        |
| 160 | 160 | return response()->json([  | 
                                                        
| 161 | 161 | 'done' => $handler->getPercentageDone(),  | 
                                                        
| 162 | 162 | 'status' => true  | 
                                                        
@@ -195,7 +195,7 @@ discard block  | 
                                                    ||
| 195 | 195 | }  | 
                                                        
| 196 | 196 | |
| 197 | 197 | // Log stored file  | 
                                                        
| 198 | -        Log::info('File Stored', ['file_id' => $fileID, 'file_path' => $filePath . DIRECTORY_SEPARATOR . $fileName]); | 
                                                        |
| 198 | +        Log::info('File Stored', ['file_id' => $fileID, 'file_path' => $filePath.DIRECTORY_SEPARATOR.$fileName]); | 
                                                        |
| 199 | 199 | return $fileID;  | 
                                                        
| 200 | 200 | }  | 
                                                        
| 201 | 201 | |
@@ -263,7 +263,7 @@ discard block  | 
                                                    ||
| 263 | 263 | // Details controller - will move to the show controller with just the tech tip id  | 
                                                        
| 264 | 264 | public function details($id, $subject)  | 
                                                        
| 265 | 265 |      { | 
                                                        
| 266 | -        if (session()->has('newTipFile')) { | 
                                                        |
| 266 | +        if(session()->has('newTipFile')) { | 
                                                        |
| 267 | 267 |              session()->forget('newTipFile'); | 
                                                        
| 268 | 268 | }  | 
                                                        
| 269 | 269 | |
@@ -293,7 +293,7 @@ discard block  | 
                                                    ||
| 293 | 293 | // Add or remove this tip as a favorite of the user  | 
                                                        
| 294 | 294 | public function toggleFav($action, $id)  | 
                                                        
| 295 | 295 |      { | 
                                                        
| 296 | -        switch ($action) { | 
                                                        |
| 296 | +        switch($action) { | 
                                                        |
| 297 | 297 | case 'add':  | 
                                                        
| 298 | 298 | TechTipFavs::create([  | 
                                                        
| 299 | 299 | 'user_id' => Auth::user()->user_id,  | 
                                                        
@@ -306,7 +306,7 @@ discard block  | 
                                                    ||
| 306 | 306 | break;  | 
                                                        
| 307 | 307 | }  | 
                                                        
| 308 | 308 | |
| 309 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); | 
                                                        |
| 309 | +        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); | 
                                                        |
| 310 | 310 |          Log::debug('Tech Tip Bookmark Updated.', [ | 
                                                        
| 311 | 311 | 'user_id' => Auth::user()->user_id,  | 
                                                        
| 312 | 312 | 'tip_id' => $id,  | 
                                                        
@@ -321,7 +321,7 @@ discard block  | 
                                                    ||
| 321 | 321 |          $this->authorize('hasAccess', 'Edit Tech Tip'); | 
                                                        
| 322 | 322 |          $tipData = TechTips::where('tip_id', $id)->with('User')->with('SystemTypes')->with('TechTipTypes')->first(); | 
                                                        
| 323 | 323 | |
| 324 | -        if (!$tipData) { | 
                                                        |
| 324 | +        if(!$tipData) { | 
                                                        |
| 325 | 325 |              return view('tips.tipNotFound'); | 
                                                        
| 326 | 326 | }  | 
                                                        
| 327 | 327 | |
@@ -329,7 +329,7 @@ discard block  | 
                                                    ||
| 329 | 329 |          $systemsArr = new SystemCategoriesCollection(SystemCategories::with('SystemTypes')->get()); | 
                                                        
| 330 | 330 |          $files = TechTipFiles::where('tip_id', $id)->with('Files')->get(); | 
                                                        
| 331 | 331 | |
| 332 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); | 
                                                        |
| 332 | +        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); | 
                                                        |
| 333 | 333 |          return view('tips.editTip', [ | 
                                                        
| 334 | 334 | 'tipTypes' => $typesArr,  | 
                                                        
| 335 | 335 | 'sysTypes' => $systemsArr,  | 
                                                        
@@ -353,9 +353,9 @@ discard block  | 
                                                    ||
| 353 | 353 |          $receiver = new FileReceiver('file', $request, HandlerFactory::classFromRequest($request)); | 
                                                        
| 354 | 354 | |
| 355 | 355 | // Verify if there is a file to be processed or not  | 
                                                        
| 356 | -        if ($receiver->isUploaded() === false || $request->_completed) { | 
                                                        |
| 356 | +        if($receiver->isUploaded() === false || $request->_completed) { | 
                                                        |
| 357 | 357 | $this->storeUpdatedTip($request, $id);  | 
                                                        
| 358 | -            Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); | 
                                                        |
| 358 | +            Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); | 
                                                        |
| 359 | 359 | return response()->json(['tip_id' => $id]);  | 
                                                        
| 360 | 360 | }  | 
                                                        
| 361 | 361 | |
@@ -363,7 +363,7 @@ discard block  | 
                                                    ||
| 363 | 363 | $save = $receiver->receive();  | 
                                                        
| 364 | 364 | |
| 365 | 365 | // See if the uploade has finished  | 
                                                        
| 366 | -        if ($save->isFinished()) { | 
                                                        |
| 366 | +        if($save->isFinished()) { | 
                                                        |
| 367 | 367 | $this->saveFile($save->getFile(), $id);  | 
                                                        
| 368 | 368 | |
| 369 | 369 | return 'uploaded successfully';  | 
                                                        
@@ -372,8 +372,8 @@ discard block  | 
                                                    ||
| 372 | 372 | // Get the current progress  | 
                                                        
| 373 | 373 | $handler = $save->handler();  | 
                                                        
| 374 | 374 | |
| 375 | -        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); | 
                                                        |
| 376 | -        Log::debug('File being uploaded.  Percentage done - ' . $handler->getPercentageDone()); | 
                                                        |
| 375 | +        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); | 
                                                        |
| 376 | +        Log::debug('File being uploaded.  Percentage done - '.$handler->getPercentageDone()); | 
                                                        |
| 377 | 377 | return response()->json([  | 
                                                        
| 378 | 378 | 'done' => $handler->getPercentageDone(),  | 
                                                        
| 379 | 379 | 'status' => true  | 
                                                        
@@ -51,14 +51,17 @@ discard block  | 
                                                    ||
| 51 | 51 |          Log::debug('request Data -> ', $request->toArray()); | 
                                                        
| 52 | 52 | |
| 53 | 53 | // See if there are any search paramaters entered  | 
                                                        
| 54 | -        if (!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) { | 
                                                        |
| 54 | + if (!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType']))  | 
                                                        |
| 55 | +        { | 
                                                        |
| 55 | 56 | // No search paramaters, send all tech tips  | 
                                                        
| 56 | 57 | $tips = new TechTipsCollection(  | 
                                                        
| 57 | 58 |                  TechTips::orderBy('created_at', 'DESC') | 
                                                        
| 58 | 59 |                      ->with('SystemTypes') | 
                                                        
| 59 | 60 | ->paginate($request->pagination['perPage'])  | 
                                                        
| 60 | 61 | );  | 
                                                        
| 61 | -        } else { | 
                                                        |
| 62 | + }  | 
                                                        |
| 63 | + else  | 
                                                        |
| 64 | +        { | 
                                                        |
| 62 | 65 | $article = isset($request->search['articleType']) ? true : false;  | 
                                                        
| 63 | 66 | $system = isset($request->search['systemType']) ? true : false;  | 
                                                        
| 64 | 67 | // Search paramaters, filter results  | 
                                                        
@@ -146,7 +149,8 @@ discard block  | 
                                                    ||
| 146 | 149 | $save = $receiver->receive();  | 
                                                        
| 147 | 150 | |
| 148 | 151 | // See if the uploade has finished  | 
                                                        
| 149 | -        if ($save->isFinished()) { | 
                                                        |
| 152 | + if ($save->isFinished())  | 
                                                        |
| 153 | +        { | 
                                                        |
| 150 | 154 | $this->saveFile($save->getFile());  | 
                                                        
| 151 | 155 | |
| 152 | 156 | return 'uploaded successfully';  | 
                                                        
@@ -248,8 +252,7 @@ discard block  | 
                                                    ||
| 248 | 252 | if(!$tipData->supressEmail)  | 
                                                        
| 249 | 253 |          { | 
                                                        
| 250 | 254 | $details = TechTips::find($tipID);  | 
                                                        
| 251 | -            $users = User::where('active', 1)->whereHas('UserSettings', function($query) | 
                                                        |
| 252 | -            { | 
                                                        |
| 255 | +            $users = User::where('active', 1)->whereHas('UserSettings', function($query) { | 
                                                        |
| 253 | 256 |                  $query->where('em_tech_tip', 1); | 
                                                        
| 254 | 257 | })->get();  | 
                                                        
| 255 | 258 | |
@@ -263,7 +266,8 @@ discard block  | 
                                                    ||
| 263 | 266 | // Details controller - will move to the show controller with just the tech tip id  | 
                                                        
| 264 | 267 | public function details($id, $subject)  | 
                                                        
| 265 | 268 |      { | 
                                                        
| 266 | -        if (session()->has('newTipFile')) { | 
                                                        |
| 269 | +        if (session()->has('newTipFile')) | 
                                                        |
| 270 | +        { | 
                                                        |
| 267 | 271 |              session()->forget('newTipFile'); | 
                                                        
| 268 | 272 | }  | 
                                                        
| 269 | 273 | |
@@ -293,7 +297,8 @@ discard block  | 
                                                    ||
| 293 | 297 | // Add or remove this tip as a favorite of the user  | 
                                                        
| 294 | 298 | public function toggleFav($action, $id)  | 
                                                        
| 295 | 299 |      { | 
                                                        
| 296 | -        switch ($action) { | 
                                                        |
| 300 | + switch ($action)  | 
                                                        |
| 301 | +        { | 
                                                        |
| 297 | 302 | case 'add':  | 
                                                        
| 298 | 303 | TechTipFavs::create([  | 
                                                        
| 299 | 304 | 'user_id' => Auth::user()->user_id,  | 
                                                        
@@ -321,7 +326,8 @@ discard block  | 
                                                    ||
| 321 | 326 |          $this->authorize('hasAccess', 'Edit Tech Tip'); | 
                                                        
| 322 | 327 |          $tipData = TechTips::where('tip_id', $id)->with('User')->with('SystemTypes')->with('TechTipTypes')->first(); | 
                                                        
| 323 | 328 | |
| 324 | -        if (!$tipData) { | 
                                                        |
| 329 | + if (!$tipData)  | 
                                                        |
| 330 | +        { | 
                                                        |
| 325 | 331 |              return view('tips.tipNotFound'); | 
                                                        
| 326 | 332 | }  | 
                                                        
| 327 | 333 | |
@@ -353,7 +359,8 @@ discard block  | 
                                                    ||
| 353 | 359 |          $receiver = new FileReceiver('file', $request, HandlerFactory::classFromRequest($request)); | 
                                                        
| 354 | 360 | |
| 355 | 361 | // Verify if there is a file to be processed or not  | 
                                                        
| 356 | -        if ($receiver->isUploaded() === false || $request->_completed) { | 
                                                        |
| 362 | + if ($receiver->isUploaded() === false || $request->_completed)  | 
                                                        |
| 363 | +        { | 
                                                        |
| 357 | 364 | $this->storeUpdatedTip($request, $id);  | 
                                                        
| 358 | 365 |              Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); | 
                                                        
| 359 | 366 | return response()->json(['tip_id' => $id]);  | 
                                                        
@@ -363,7 +370,8 @@ discard block  | 
                                                    ||
| 363 | 370 | $save = $receiver->receive();  | 
                                                        
| 364 | 371 | |
| 365 | 372 | // See if the uploade has finished  | 
                                                        
| 366 | -        if ($save->isFinished()) { | 
                                                        |
| 373 | + if ($save->isFinished())  | 
                                                        |
| 374 | +        { | 
                                                        |
| 367 | 375 | $this->saveFile($save->getFile(), $id);  | 
                                                        
| 368 | 376 | |
| 369 | 377 | return 'uploaded successfully';  | 
                                                        
@@ -36,13 +36,13 @@ discard block  | 
                                                    ||
| 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', 'Modify Category') | 
                                                        
| 48 | 48 |                      ->orWhere('description', 'Create Category'); | 
                                                        
@@ -64,7 +64,7 @@ discard block  | 
                                                    ||
| 64 | 64 | }  | 
                                                        
| 65 | 65 | |
| 66 | 66 |          $data = UserRolePermissions::with('UserRolePermissionTypes') | 
                                                        
| 67 | -            ->whereHas('UserRolePermissionTypes', function ($query) use ($task) { | 
                                                        |
| 67 | +            ->whereHas('UserRolePermissionTypes', function($query) use ($task) { | 
                                                        |
| 68 | 68 |                  $query->where('description', $task); | 
                                                        
| 69 | 69 | })  | 
                                                        
| 70 | 70 |              ->where('role_id', $user->role_id) | 
                                                        
@@ -72,7 +72,7 @@ discard block  | 
                                                    ||
| 72 | 72 | ->get();  | 
                                                        
| 73 | 73 | |
| 74 | 74 | $allow = $data->isEmpty() ? 'false' : 'true';  | 
                                                        
| 75 | -        \Log::debug('User '.$user->full_name.' is trying to access '.$task.'.  Result - ' . $allow); | 
                                                        |
| 75 | +        \Log::debug('User '.$user->full_name.' is trying to access '.$task.'.  Result - '.$allow); | 
                                                        |
| 76 | 76 | |
| 77 | 77 | return $data->isEmpty() ? false : true;  | 
                                                        
| 78 | 78 | }  | 
                                                        
@@ -5,7 +5,7 @@  | 
                                                    ||
| 5 | 5 | use App\UserRoleType;  | 
                                                        
| 6 | 6 | use Faker\Generator as Faker;  | 
                                                        
| 7 | 7 | |
| 8 | -$factory->define(UserRoleType::class, function (Faker $faker) { | 
                                                        |
| 8 | +$factory->define(UserRoleType::class, function(Faker $faker) { | 
                                                        |
| 9 | 9 | return [  | 
                                                        
| 10 | 10 | //  | 
                                                        
| 11 | 11 | 'name' => $faker->words(2, true),  | 
                                                        
@@ -15,7 +15,7 @@ discard block  | 
                                                    ||
| 15 | 15 | */  | 
                                                        
| 16 | 16 | public function up()  | 
                                                        
| 17 | 17 |      { | 
                                                        
| 18 | -        Schema::create('user_role_permission_types', function (Blueprint $table) { | 
                                                        |
| 18 | +        Schema::create('user_role_permission_types', function(Blueprint $table) { | 
                                                        |
| 19 | 19 |              $table->increments('perm_type_id'); | 
                                                        
| 20 | 20 |              $table->text('description'); | 
                                                        
| 21 | 21 | $table->timestamps();  | 
                                                        
@@ -23,17 +23,17 @@ discard block  | 
                                                    ||
| 23 | 23 | |
| 24 | 24 | // Insert default data  | 
                                                        
| 25 | 25 |          DB::table('user_role_permission_types')->insert([ | 
                                                        
| 26 | - ['perm_type_id' => 1, 'description' => 'Manage Users', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 27 | - ['perm_type_id' => 2, 'description' => 'Run Reports', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 28 | - ['perm_type_id' => 3, 'description' => 'Add Customer', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 29 | - ['perm_type_id' => 4, 'description' => 'Deactivate Customer', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 30 | - ['perm_type_id' => 5, 'description' => 'Use File Links', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 31 | - ['perm_type_id' => 6, 'description' => 'Create Tech Tip', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 32 | - ['perm_type_id' => 7, 'description' => 'Edit Tech Tip', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 33 | - ['perm_type_id' => 8, 'description' => 'Delete Tech Tip', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 34 | - ['perm_type_id' => 9, 'description' => 'Create Category', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 35 | - ['perm_type_id' => 10, 'description' => 'Modify Category', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 36 | - ['perm_type_id' => 11, 'description' => 'Modify User Roles', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 26 | + ['perm_type_id' => 1, 'description' => 'Manage Users', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 27 | + ['perm_type_id' => 2, 'description' => 'Run Reports', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 28 | + ['perm_type_id' => 3, 'description' => 'Add Customer', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 29 | + ['perm_type_id' => 4, 'description' => 'Deactivate Customer', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 30 | + ['perm_type_id' => 5, 'description' => 'Use File Links', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 31 | + ['perm_type_id' => 6, 'description' => 'Create Tech Tip', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 32 | + ['perm_type_id' => 7, 'description' => 'Edit Tech Tip', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 33 | + ['perm_type_id' => 8, 'description' => 'Delete Tech Tip', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 34 | + ['perm_type_id' => 9, 'description' => 'Create Category', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 35 | + ['perm_type_id' => 10, 'description' => 'Modify Category', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 36 | + ['perm_type_id' => 11, 'description' => 'Modify User Roles', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 37 | 37 | ]);  | 
                                                        
| 38 | 38 | }  | 
                                                        
| 39 | 39 | |
@@ -14,7 +14,7 @@  | 
                                                    ||
| 14 | 14 | */  | 
                                                        
| 15 | 15 | public function up()  | 
                                                        
| 16 | 16 |      { | 
                                                        
| 17 | -        Schema::create('user_role_permissions', function (Blueprint $table) { | 
                                                        |
| 17 | +        Schema::create('user_role_permissions', function(Blueprint $table) { | 
                                                        |
| 18 | 18 |              $table->increments('id'); | 
                                                        
| 19 | 19 |              $table->integer('role_id')->unsigned(); | 
                                                        
| 20 | 20 |              $table->integer('perm_type_id')->unsigned(); | 
                                                        
@@ -16,7 +16,7 @@ discard block  | 
                                                    ||
| 16 | 16 | */  | 
                                                        
| 17 | 17 | public function up()  | 
                                                        
| 18 | 18 |      { | 
                                                        
| 19 | -        Schema::create('user_role_types', function (Blueprint $table) { | 
                                                        |
| 19 | +        Schema::create('user_role_types', function(Blueprint $table) { | 
                                                        |
| 20 | 20 |              $table->increments('role_id'); | 
                                                        
| 21 | 21 |              $table->text('name'); | 
                                                        
| 22 | 22 |              $table->text('description'); | 
                                                        
@@ -26,10 +26,10 @@ discard block  | 
                                                    ||
| 26 | 26 | |
| 27 | 27 | // Insert default data  | 
                                                        
| 28 | 28 |          DB::table('user_role_types')->insert([ | 
                                                        
| 29 | - ['role_id' => 1, 'name' => 'Installer', 'description' => 'All Access Administrator', 'allow_edit' => 0, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 30 | - ['role_id' => 2, 'name' => 'Administrator', 'description' => 'System Administrator', 'allow_edit' => 0, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 31 | - ['role_id' => 3, 'name' => 'Reports', 'description' => 'User who can run reports', 'allow_edit' => 0, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 32 | - ['role_id' => 4, 'name' => 'Tech', 'description' => 'Standard User', 'allow_edit' => 0, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 29 | + ['role_id' => 1, 'name' => 'Installer', 'description' => 'All Access Administrator', 'allow_edit' => 0, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 30 | + ['role_id' => 2, 'name' => 'Administrator', 'description' => 'System Administrator', 'allow_edit' => 0, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 31 | + ['role_id' => 3, 'name' => 'Reports', 'description' => 'User who can run reports', 'allow_edit' => 0, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 32 | + ['role_id' => 4, 'name' => 'Tech', 'description' => 'Standard User', 'allow_edit' => 0, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],  | 
                                                        |
| 33 | 33 | ]);  | 
                                                        
| 34 | 34 | |
| 35 | 35 | // Update the users table to include the 'user_role' column  | 
                                                        
@@ -35,8 +35,7 @@  | 
                                                    ||
| 35 | 35 | // Update the users table to include the 'user_role' column  | 
                                                        
| 36 | 36 |          if(!Schema::hasColumn('users', 'role_id')) | 
                                                        
| 37 | 37 |          { | 
                                                        
| 38 | -            Schema::table('users', function(Blueprint $table) | 
                                                        |
| 39 | -            { | 
                                                        |
| 38 | +            Schema::table('users', function(Blueprint $table) { | 
                                                        |
| 40 | 39 |                  $table->integer('role_id')->unsigned()->after('user_id')->default(4); | 
                                                        
| 41 | 40 |                  $table->foreign('role_id')->references('role_id')->on('user_role_types')->onUpdate('cascade'); | 
                                                        
| 42 | 41 | });  | 
                                                        
@@ -65,8 +65,8 @@ discard block  | 
                                                    ||
| 65 | 65 | private function updatePhoneIcons()  | 
                                                        
| 66 | 66 |      { | 
                                                        
| 67 | 67 | $newIcons = [  | 
                                                        
| 68 | - ['description' => 'Home', 'icon_class' => 'ti-home'],  | 
                                                        |
| 69 | - ['description' => 'Work', 'icon_class' => 'ti-briefcase'],  | 
                                                        |
| 68 | + ['description' => 'Home', 'icon_class' => 'ti-home'],  | 
                                                        |
| 69 | + ['description' => 'Work', 'icon_class' => 'ti-briefcase'],  | 
                                                        |
| 70 | 70 | ['description' => 'Mobile', 'icon_class' => 'ti-mobile'],  | 
                                                        
| 71 | 71 | ];  | 
                                                        
| 72 | 72 | |
@@ -98,7 +98,7 @@ discard block  | 
                                                    ||
| 98 | 98 |          { | 
                                                        
| 99 | 99 |              if(!Schema::hasColumn('users', 'role_id')) | 
                                                        
| 100 | 100 |              { | 
                                                        
| 101 | -                Schema::table('users', function (Blueprint $table) { | 
                                                        |
| 101 | +                Schema::table('users', function(Blueprint $table) { | 
                                                        |
| 102 | 102 |                      $table->integer('role_id')->after('user_id')->unsigned()->default(4); | 
                                                        
| 103 | 103 |                      $table->foreign('role_id')->references('role_id')->on('user_role_descriptions')->onUpdate('cascade'); | 
                                                        
| 104 | 104 | });  | 
                                                        
@@ -325,8 +325,8 @@ discard block  | 
                                                    ||
| 325 | 325 | // Add soft deletes to tech tips table to prevent accidental deletes  | 
                                                        
| 326 | 326 | private function addSoftDeleteToTechTips()  | 
                                                        
| 327 | 327 |      { | 
                                                        
| 328 | -        if (!Schema::hasColumn('tech_tips', 'deleted_at')) { | 
                                                        |
| 329 | -            Schema::table('tech_tips', function (Blueprint $table) { | 
                                                        |
| 328 | +        if(!Schema::hasColumn('tech_tips', 'deleted_at')) { | 
                                                        |
| 329 | +            Schema::table('tech_tips', function(Blueprint $table) { | 
                                                        |
| 330 | 330 |                  $table->softDeletes()->after('description'); | 
                                                        
| 331 | 331 | });  | 
                                                        
| 332 | 332 | }  |