@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | // Show the links for the selected user |
| 56 | 56 | public function showLinks($id) |
| 57 | 57 | { |
| 58 | - $user = User::find($id); |
|
| 58 | + $user = User::find($id); |
|
| 59 | 59 | |
| 60 | 60 | Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
| 61 | 61 | return view('admin.linkDetails', [ |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | // Determine if the password expires field is updated |
| 86 | 86 | $oldExpire = config('users.passExpires'); |
| 87 | - if ($request->passExpire != $oldExpire) { |
|
| 87 | + if($request->passExpire != $oldExpire) { |
|
| 88 | 88 | // Update the setting in the database |
| 89 | 89 | Settings::where('key', 'users.passExpires')->update([ |
| 90 | 90 | 'value' => $request->passExpire |
| 91 | 91 | ]); |
| 92 | 92 | // If the setting is changing from never to xx days, update all users |
| 93 | - if ($request->passExpire == 0) { |
|
| 93 | + if($request->passExpire == 0) { |
|
| 94 | 94 | User::whereNotNull('password_expires')->update([ |
| 95 | 95 | 'password_expires' => null |
| 96 | 96 | ]); |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | ]); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
|
| 106 | + Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
| 107 | 107 | Log::debug('Submitted Data - ', $request->toArray()); |
| 108 | - Log::notice('User Settings have been changed by User ID-' . Auth::user()->user_id); |
|
| 108 | + Log::notice('User Settings have been changed by User ID-'.Auth::user()->user_id); |
|
| 109 | 109 | return redirect()->back()->with('success', 'User Security Updated'); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | 'name' => $request->name, |
| 166 | 166 | 'description' => $request->description, |
| 167 | 167 | ]); |
| 168 | - foreach ($request->permissions as $perm) |
|
| 168 | + foreach($request->permissions as $perm) |
|
| 169 | 169 | { |
| 170 | 170 | UserRolePermissions::create([ |
| 171 | 171 | 'role_id' => $role->role_id, |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | $userLinks = new UserCollection( |
| 38 | 38 | User::withCount([ |
| 39 | 39 | 'FileLinks', |
| 40 | - 'FileLinks as expired_file_links_count' => function($query) |
|
| 41 | - { |
|
| 40 | + 'FileLinks as expired_file_links_count' => function($query) { |
|
| 42 | 41 | $query->where('expire', '<', Carbon::now()); |
| 43 | 42 | } |
| 44 | 43 | ]) |
@@ -84,13 +83,15 @@ discard block |
||
| 84 | 83 | |
| 85 | 84 | // Determine if the password expires field is updated |
| 86 | 85 | $oldExpire = config('users.passExpires'); |
| 87 | - if ($request->passExpire != $oldExpire) { |
|
| 86 | + if ($request->passExpire != $oldExpire) |
|
| 87 | + { |
|
| 88 | 88 | // Update the setting in the database |
| 89 | 89 | Settings::where('key', 'users.passExpires')->update([ |
| 90 | 90 | 'value' => $request->passExpire |
| 91 | 91 | ]); |
| 92 | 92 | // If the setting is changing from never to xx days, update all users |
| 93 | - if ($request->passExpire == 0) { |
|
| 93 | + if ($request->passExpire == 0) |
|
| 94 | + { |
|
| 94 | 95 | User::whereNotNull('password_expires')->update([ |
| 95 | 96 | 'password_expires' => null |
| 96 | 97 | ]); |
@@ -113,8 +114,7 @@ discard block |
||
| 113 | 114 | public function roleSettings() |
| 114 | 115 | { |
| 115 | 116 | $this->authorize('hasAccess', 'Manage User Roles'); |
| 116 | - $roles = UserRoleType::with(['UserRolePermissions' => function($query) |
|
| 117 | - { |
|
| 117 | + $roles = UserRoleType::with(['UserRolePermissions' => function($query) { |
|
| 118 | 118 | $query->join('user_role_permission_types', 'user_role_permission_types.perm_type_id', '=', 'user_role_permissions.perm_type_id'); |
| 119 | 119 | }])->get(); |
| 120 | 120 | $perms = UserRolePermissionTypes::all(); |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | public function __construct() |
| 32 | 32 | { |
| 33 | 33 | $this->middleware('auth')->except('initializeUser', 'submitInitializeUser'); |
| 34 | - $this->middleware(function ($request, $next) { |
|
| 35 | - $this->user = auth()->user(); // TODO - is this correct???? |
|
| 34 | + $this->middleware(function($request, $next) { |
|
| 35 | + $this->user = auth()->user(); // TODO - is this correct???? |
|
| 36 | 36 | $this->authorize('hasAccess', 'Manage Users'); |
| 37 | 37 | return $next($request); |
| 38 | 38 | }); |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | // Show the list of current users to edit |
| 42 | 42 | public function index() |
| 43 | 43 | { |
| 44 | - $userList = new UserCollection(User::with(['UserLogins' => function ($query) { |
|
| 44 | + $userList = new UserCollection(User::with(['UserLogins' => function($query) { |
|
| 45 | 45 | $query->latest()->limit(1); |
| 46 | 46 | }])->get() |
| 47 | 47 | /** @scrutinizer ignore-call */ |
| 48 | 48 | ->makeVisible('user_id')); |
| 49 | - $route = 'admin.user.edit'; |
|
| 49 | + $route = 'admin.user.edit'; |
|
| 50 | 50 | |
| 51 | 51 | return view('admin.userIndex', [ |
| 52 | 52 | 'userList' => $userList, |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | // Validate the new user form |
| 110 | 110 | $request->validate([ |
| 111 | - 'role' => 'required|numeric', // TODO - add validation rule - is in user roles table |
|
| 111 | + 'role' => 'required|numeric', // TODO - add validation rule - is in user roles table |
|
| 112 | 112 | 'username' => 'required|unique:users|regex:/^[a-zA-Z0-9_]*$/', |
| 113 | 113 | 'first_name' => 'required', |
| 114 | 114 | 'last_name' => 'required', |
@@ -174,17 +174,17 @@ discard block |
||
| 174 | 174 | $user = new UserResource(User::findOrFail($id)); |
| 175 | 175 | |
| 176 | 176 | // Make sure that the user is not trying to deactivate someone with more permissions |
| 177 | - if ($user->role_id < Auth::user()->role_id) |
|
| 177 | + if($user->role_id < Auth::user()->role_id) |
|
| 178 | 178 | { |
| 179 | 179 | return abort(403); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // Good to go - update user password |
| 183 | 183 | $roleArr = []; |
| 184 | - foreach ($roles as $role) { |
|
| 185 | - if ($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
| 184 | + foreach($roles as $role) { |
|
| 185 | + if($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
| 186 | 186 | continue; |
| 187 | - } else if ($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
| 187 | + } else if($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
| 188 | 188 | continue; |
| 189 | 189 | } else { |
| 190 | 190 | // $roleArr[$role->role_id] = $role->name; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
|
| 198 | + Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
| 199 | 199 | return view('admin.userEdit', [ |
| 200 | 200 | 'roles' => $roleArr, |
| 201 | 201 | 'user' => $user->makeVisible(['user_id', 'username']), |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | // Update the user data |
| 233 | 233 | $user = User::findOrFail($id); |
| 234 | 234 | |
| 235 | - if ($user->role_id < Auth::user()->role_id) |
|
| 235 | + if($user->role_id < Auth::user()->role_id) |
|
| 236 | 236 | { |
| 237 | 237 | return abort(403); |
| 238 | 238 | } |
@@ -275,12 +275,12 @@ discard block |
||
| 275 | 275 | $user = User::find($request->user_id); |
| 276 | 276 | |
| 277 | 277 | // Verify this is a valid user ID |
| 278 | - if (!$user) { |
|
| 278 | + if(!$user) { |
|
| 279 | 279 | $success = false; |
| 280 | 280 | $reason = 'Cannot find user with this ID'; |
| 281 | 281 | } |
| 282 | 282 | // Make sure that the user is not trying to deactivate someone with more permissions |
| 283 | - else if ($user->role_id < Auth::user()->role_id) { |
|
| 283 | + else if($user->role_id < Auth::user()->role_id) { |
|
| 284 | 284 | $success = false; |
| 285 | 285 | $reason = 'You cannot change password for a user with higher permissions that you. If this user has locked themselves out, have then use the reset link on the login page.'; |
| 286 | 286 | } |
@@ -293,11 +293,11 @@ discard block |
||
| 293 | 293 | 'password_expires' => $nextChange |
| 294 | 294 | ]); |
| 295 | 295 | $success = true; |
| 296 | - $reason = 'Password for ' . $user->full_name . ' successfully reset.'; |
|
| 296 | + $reason = 'Password for '.$user->full_name.' successfully reset.'; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
|
| 300 | - Log::notice('User ID-' . $request->user_id . ' password chagned by ' . Auth::user()->user_id, [ |
|
| 299 | + Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
| 300 | + Log::notice('User ID-'.$request->user_id.' password chagned by '.Auth::user()->user_id, [ |
|
| 301 | 301 | 'success' => $success, |
| 302 | 302 | 'reason' => $reason, |
| 303 | 303 | ]); |
@@ -181,12 +181,18 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | // Good to go - update user password |
| 183 | 183 | $roleArr = []; |
| 184 | - foreach ($roles as $role) { |
|
| 185 | - if ($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
| 184 | + foreach ($roles as $role) |
|
| 185 | + { |
|
| 186 | + if ($role->role_id == 1 && Auth::user()->role_id != 1) |
|
| 187 | + { |
|
| 186 | 188 | continue; |
| 187 | - } else if ($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
| 189 | + } |
|
| 190 | + else if ($role->role_id == 2 && Auth::user()->role_id > 1) |
|
| 191 | + { |
|
| 188 | 192 | continue; |
| 189 | - } else { |
|
| 193 | + } |
|
| 194 | + else |
|
| 195 | + { |
|
| 190 | 196 | // $roleArr[$role->role_id] = $role->name; |
| 191 | 197 | $roleArr[] = [ |
| 192 | 198 | 'value' => $role->role_id, |
@@ -275,17 +281,20 @@ discard block |
||
| 275 | 281 | $user = User::find($request->user_id); |
| 276 | 282 | |
| 277 | 283 | // Verify this is a valid user ID |
| 278 | - if (!$user) { |
|
| 284 | + if (!$user) |
|
| 285 | + { |
|
| 279 | 286 | $success = false; |
| 280 | 287 | $reason = 'Cannot find user with this ID'; |
| 281 | 288 | } |
| 282 | 289 | // Make sure that the user is not trying to deactivate someone with more permissions |
| 283 | - else if ($user->role_id < Auth::user()->role_id) { |
|
| 290 | + else if ($user->role_id < Auth::user()->role_id) |
|
| 291 | + { |
|
| 284 | 292 | $success = false; |
| 285 | 293 | $reason = 'You cannot change password for a user with higher permissions that you. If this user has locked themselves out, have then use the reset link on the login page.'; |
| 286 | 294 | } |
| 287 | 295 | // Good to go - update user password |
| 288 | - else { |
|
| 296 | + else |
|
| 297 | + { |
|
| 289 | 298 | // Update the user data |
| 290 | 299 | $user->update( |
| 291 | 300 | [ |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function __construct() |
| 16 | 16 | { |
| 17 | 17 | $this->middleware('auth'); |
| 18 | - $this->middleware(function ($request, $next) { |
|
| 18 | + $this->middleware(function($request, $next) { |
|
| 19 | 19 | $this->authorize('hasAccess', 'Manage Equipment'); |
| 20 | 20 | return $next($request); |
| 21 | 21 | }); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | SystemCategories::find($id)->delete(); |
| 122 | 122 | return response()->json(['success' => true, 'reason' => 'Category Successfully Deleted']); |
| 123 | 123 | } |
| 124 | - catch (\Illuminate\Database\QueryException $e) |
|
| 124 | + catch(\Illuminate\Database\QueryException $e) |
|
| 125 | 125 | { |
| 126 | 126 | return response()->json(['success' => false, 'reason' => 'Category still in use. You must delete all systems attached to this category first.']); |
| 127 | 127 | } |
@@ -117,7 +117,8 @@ |
||
| 117 | 117 | */ |
| 118 | 118 | public function destroy($id) |
| 119 | 119 | { |
| 120 | - try { |
|
| 120 | + try |
|
| 121 | + { |
|
| 121 | 122 | SystemCategories::find($id)->delete(); |
| 122 | 123 | return response()->json(['success' => true, 'reason' => 'Category Successfully Deleted']); |
| 123 | 124 | } |
@@ -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::whereHas('UserSettings', function($query) |
|
| 252 | - { |
|
| 255 | + $users = User::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'; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | // Database primary key |
| 22 | 22 | protected $primaryKey = 'user_id'; |
| 23 | 23 | |
| 24 | - protected $appends = [ 'full_name' ]; |
|
| 24 | + protected $appends = ['full_name']; |
|
| 25 | 25 | protected $casts = [ |
| 26 | 26 | 'created_at' => 'datetime:M d, Y', |
| 27 | 27 | 'updated_at' => 'datetime:M d, Y', |
@@ -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 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | // Migrate over all deactivated users |
| 345 | 345 | DB::update('UPDATE `users` SET `deleted_at` = "'.Carbon::now().'" WHERE `active` = 0'); |
| 346 | 346 | // Remove the Active column |
| 347 | - Schema::table('users', function (Blueprint $table) { |
|
| 347 | + Schema::table('users', function(Blueprint $table) { |
|
| 348 | 348 | $table->dropColumn('active'); |
| 349 | 349 | }); |
| 350 | 350 | } |
@@ -82,7 +82,8 @@ discard block |
||
| 82 | 82 | // Added the ability to set an expiration date for user passwords - will force them to change after this expires |
| 83 | 83 | private function addPasswordExpiresColumn() |
| 84 | 84 | { |
| 85 | - if(!Schema::hasColumn('users', 'password_expires')) { |
|
| 85 | + if(!Schema::hasColumn('users', 'password_expires')) |
|
| 86 | + { |
|
| 86 | 87 | Schema::table('users', function(Blueprint $table) { |
| 87 | 88 | $table->timestamp('password_expires') |
| 88 | 89 | ->nullable() |
@@ -118,7 +119,8 @@ discard block |
||
| 118 | 119 | // Added a 'hidden' attribute to system customer data types to allow passwords to not be viewed unless clicked or focus |
| 119 | 120 | private function addHiddenColumn() |
| 120 | 121 | { |
| 121 | - if(!Schema::hasColumn('system_data_field_types', 'hidden')) { |
|
| 122 | + if(!Schema::hasColumn('system_data_field_types', 'hidden')) |
|
| 123 | + { |
|
| 122 | 124 | Schema::table('system_cust_data_types', function(Blueprint $table) { |
| 123 | 125 | $table->boolean('hidden') |
| 124 | 126 | ->default(0) |
@@ -130,7 +132,8 @@ discard block |
||
| 130 | 132 | // Update the File links table - add cust_id and note column |
| 131 | 133 | private function addColumnsToFileLinksTable() |
| 132 | 134 | { |
| 133 | - if(!Schema::hasColumn('file_links', 'cust_id')) { |
|
| 135 | + if(!Schema::hasColumn('file_links', 'cust_id')) |
|
| 136 | + { |
|
| 134 | 137 | Schema::table('file_links', function(Blueprint $table) { |
| 135 | 138 | $table->integer('cust_id') |
| 136 | 139 | ->unsigned() |
@@ -139,7 +142,8 @@ discard block |
||
| 139 | 142 | $table->foreign('cust_id')->references('cust_id')->on('customers')->onUpdate('cascade')->onDelete('cascade'); |
| 140 | 143 | }); |
| 141 | 144 | } |
| 142 | - if(!Schema::hasColumn('file_links', 'note')) { |
|
| 145 | + if(!Schema::hasColumn('file_links', 'note')) |
|
| 146 | + { |
|
| 143 | 147 | Schema::table('file_links', function(Blueprint $table) { |
| 144 | 148 | $table->longText('note') |
| 145 | 149 | ->nullable() |
@@ -147,7 +151,8 @@ discard block |
||
| 147 | 151 | }); |
| 148 | 152 | // Migrate the instructions from the old table to the new column |
| 149 | 153 | $instructions = DB::select('SELECT * FROM `file_link_instructions`'); |
| 150 | - foreach($instructions as $ins) { |
|
| 154 | + foreach($instructions as $ins) |
|
| 155 | + { |
|
| 151 | 156 | FileLinks::find($ins->link_id)->update([ |
| 152 | 157 | 'note' => $ins->instruction |
| 153 | 158 | ]); |
@@ -158,7 +163,8 @@ discard block |
||
| 158 | 163 | // Add Notes column to the file links files table |
| 159 | 164 | private function addNotesColumnToFileLinkFiles() |
| 160 | 165 | { |
| 161 | - if(!Schema::hasColumn('file_link_files', 'note')) { |
|
| 166 | + if(!Schema::hasColumn('file_link_files', 'note')) |
|
| 167 | + { |
|
| 162 | 168 | Schema::table('file_link_files', function(Blueprint $table) { |
| 163 | 169 | $table->longText('note') |
| 164 | 170 | ->nullable() |
@@ -166,7 +172,8 @@ discard block |
||
| 166 | 172 | }); |
| 167 | 173 | // Migrate the existing notes to the new table |
| 168 | 174 | $notes = DB::select('SELECT * FROM `file_link_notes`'); |
| 169 | - foreach($notes as $note) { |
|
| 175 | + foreach($notes as $note) |
|
| 176 | + { |
|
| 170 | 177 | FileLinkFiles::where('file_id', $note->file_id)->update([ |
| 171 | 178 | 'note' => $note->note |
| 172 | 179 | ]); |
@@ -177,7 +184,8 @@ discard block |
||
| 177 | 184 | // Add the documentation column to the tech tips table |
| 178 | 185 | private function migrateSystemDocumentation() |
| 179 | 186 | { |
| 180 | - if(!Schema::hasColumn('tech_tips', 'tip_type_id')) { |
|
| 187 | + if(!Schema::hasColumn('tech_tips', 'tip_type_id')) |
|
| 188 | + { |
|
| 181 | 189 | Schema::table('tech_tips', function(Blueprint $table) { |
| 182 | 190 | $table->bigInteger('tip_type_id')->unsigned()->after('public')->default(1); |
| 183 | 191 | $table->foreign('tip_type_id')->references('tip_type_id')->on('tech_tip_types')->onUpdate('cascade'); |
@@ -185,7 +193,8 @@ discard block |
||
| 185 | 193 | |
| 186 | 194 | // Move all of the system files over to the tech tips table |
| 187 | 195 | $sysFiles = DB::select('SELECT * FROM `system_files`'); |
| 188 | - foreach($sysFiles as $sysFile) { |
|
| 196 | + foreach($sysFiles as $sysFile) |
|
| 197 | + { |
|
| 189 | 198 | $newTip = TechTips::create([ |
| 190 | 199 | 'user_id' => $sysFile->user_id, |
| 191 | 200 | 'public' => 0, |
@@ -279,7 +288,8 @@ discard block |
||
| 279 | 288 | // Remove the system files and system file types table |
| 280 | 289 | private function removeSystemFilesTables() |
| 281 | 290 | { |
| 282 | - if(Schema::hasTable('system_files')) { |
|
| 291 | + if(Schema::hasTable('system_files')) |
|
| 292 | + { |
|
| 283 | 293 | Schema::table('system_files', function(Blueprint $table) { |
| 284 | 294 | $table->dropForeign(['sys_id']); |
| 285 | 295 | $table->dropForeign(['type_id']); |
@@ -325,7 +335,8 @@ discard block |
||
| 325 | 335 | // Add soft deletes to tech tips table to prevent accidental deletes |
| 326 | 336 | private function addSoftDeleteToTechTips() |
| 327 | 337 | { |
| 328 | - if (!Schema::hasColumn('tech_tips', 'deleted_at')) { |
|
| 338 | + if (!Schema::hasColumn('tech_tips', 'deleted_at')) |
|
| 339 | + { |
|
| 329 | 340 | Schema::table('tech_tips', function (Blueprint $table) { |
| 330 | 341 | $table->softDeletes()->after('description'); |
| 331 | 342 | }); |
@@ -337,8 +348,7 @@ discard block |
||
| 337 | 348 | { |
| 338 | 349 | if(!Schema::hasColumn('users', 'deleted_at')) |
| 339 | 350 | { |
| 340 | - Schema::table('users', function(Blueprint $table) |
|
| 341 | - { |
|
| 351 | + Schema::table('users', function(Blueprint $table) { |
|
| 342 | 352 | $table->softDeletes()->after('password_expires'); |
| 343 | 353 | }); |
| 344 | 354 | // Migrate over all deactivated users |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | use App\UserRolePermissionTypes; |
| 6 | 6 | use Faker\Generator as Faker; |
| 7 | 7 | |
| 8 | -$factory->define(UserRolePermissionTypes::class, function (Faker $faker) { |
|
| 8 | +$factory->define(UserRolePermissionTypes::class, function(Faker $faker) { |
|
| 9 | 9 | return [ |
| 10 | 10 | // |
| 11 | 11 | 'description' => $faker->words(2, true), |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | use App\UserRolePermissions; |
| 6 | 6 | use Faker\Generator as Faker; |
| 7 | 7 | |
| 8 | -$factory->define(UserRolePermissionsFactory::class, function (Faker $faker) { |
|
| 8 | +$factory->define(UserRolePermissionsFactory::class, function(Faker $faker) { |
|
| 9 | 9 | return [ |
| 10 | 10 | // |
| 11 | 11 | 'role_id' => factory(App\UserRoleTypes::class)->create()->role_id, |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | |
| 119 | - // // System custionization settings |
|
| 119 | + // // System custionization settings |
|
| 120 | 120 | // Route::get('system-customization', 'Installer\SettingsController@customizeSystem')->name('customize'); |
| 121 | 121 | // Route::post('system-customization', 'Installer\SettingsController@submitCustomizeSystem')->name('customize'); |
| 122 | 122 | // Route::post('new-logo', 'Installer\SettingsController@submitLogo')->name('submitLogo'); |
@@ -8,8 +8,8 @@ discard block |
||
| 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 | |
@@ -21,52 +21,52 @@ discard block |
||
| 21 | 21 | /* |
| 22 | 22 | * Download File Routes |
| 23 | 23 | */ |
| 24 | -Route::get('download/{id}/{filename}', 'DownloadController@index') ->name('download'); |
|
| 24 | +Route::get('download/{id}/{filename}', 'DownloadController@index') ->name('download'); |
|
| 25 | 25 | Route::get('download-archive/{filename}', 'DownloadController@downloadArchive')->name('downloadArchive'); |
| 26 | -Route::put('download-archive', 'DownloadController@archiveFiles') ->name('archiveFiles'); |
|
| 26 | +Route::put('download-archive', 'DownloadController@archiveFiles') ->name('archiveFiles'); |
|
| 27 | 27 | |
| 28 | 28 | /* |
| 29 | 29 | * User Settings Routes |
| 30 | 30 | */ |
| 31 | -Route::get('account', 'AccountController@index') ->name('account'); |
|
| 32 | -Route::post('account', 'AccountController@submit') ->name('account'); |
|
| 33 | -Route::put('account', 'AccountController@notifications') ->name('account'); |
|
| 34 | -Route::get('/account/change-password', 'AccountController@changePassword')->name('changePassword'); |
|
| 31 | +Route::get('account', 'AccountController@index') ->name('account'); |
|
| 32 | +Route::post('account', 'AccountController@submit') ->name('account'); |
|
| 33 | +Route::put('account', 'AccountController@notifications') ->name('account'); |
|
| 34 | +Route::get('/account/change-password', 'AccountController@changePassword')->name('changePassword'); |
|
| 35 | 35 | Route::post('/account/change-password', 'AccountController@submitPassword')->name('changePassword'); |
| 36 | 36 | |
| 37 | 37 | /* |
| 38 | 38 | * Basic Logged In Routes |
| 39 | 39 | */ |
| 40 | -Route::get('about', 'DashboardController@about') ->name('about'); |
|
| 41 | -Route::get('dashboard', 'DashboardController@index') ->name('dashboard'); |
|
| 42 | -Route::get('notifications', 'DashboardController@getNotifications')->name('getNotifications'); |
|
| 40 | +Route::get('about', 'DashboardController@about') ->name('about'); |
|
| 41 | +Route::get('dashboard', 'DashboardController@index') ->name('dashboard'); |
|
| 42 | +Route::get('notifications', 'DashboardController@getNotifications')->name('getNotifications'); |
|
| 43 | 43 | Route::get('mark-notification/{id}', 'DashboardController@markNotification')->name('markNotification'); |
| 44 | -Route::delete('notifications/{id}', 'DashboardController@delNotification') ->name('delNotification'); |
|
| 44 | +Route::delete('notifications/{id}', 'DashboardController@delNotification') ->name('delNotification'); |
|
| 45 | 45 | |
| 46 | 46 | /* |
| 47 | 47 | * File Link Routes |
| 48 | 48 | */ |
| 49 | -Route::prefix('links')->name('links.')->group(function () { |
|
| 49 | +Route::prefix('links')->name('links.')->group(function() { |
|
| 50 | 50 | // Resource controllers for base access |
| 51 | - Route::resource('data', 'FileLinks\FileLinksController'); |
|
| 52 | - Route::get('new', 'FileLinks\FileLinksController@create') ->name('new'); |
|
| 53 | - Route::get('find/{id}', 'FileLinks\FileLinksController@find') ->name('user'); |
|
| 51 | + Route::resource('data', 'FileLinks\FileLinksController'); |
|
| 52 | + Route::get('new', 'FileLinks\FileLinksController@create') ->name('new'); |
|
| 53 | + Route::get('find/{id}', 'FileLinks\FileLinksController@find') ->name('user'); |
|
| 54 | 54 | Route::get('details/{id}/{name}', 'FileLinks\FileLinksController@details') ->name('details'); |
| 55 | - Route::get('disable/{id}', 'FileLinks\FileLinksController@disableLink')->name('disable'); |
|
| 55 | + Route::get('disable/{id}', 'FileLinks\FileLinksController@disableLink')->name('disable'); |
|
| 56 | 56 | // File Link Files |
| 57 | - Route::resource('files', 'FileLinks\LinkFilesController'); |
|
| 57 | + Route::resource('files', 'FileLinks\LinkFilesController'); |
|
| 58 | 58 | // Index landing page |
| 59 | - Route::get('/', 'FileLinks\FileLinksController@index') ->name('index'); |
|
| 59 | + Route::get('/', 'FileLinks\FileLinksController@index') ->name('index'); |
|
| 60 | 60 | }); |
| 61 | 61 | |
| 62 | 62 | /* |
| 63 | 63 | * Guest File Link Routes |
| 64 | 64 | */ |
| 65 | 65 | Route::get('file-links/{id}/get-files', 'FileLinks\GuestLinksController@getFiles')->name('file-links.getFiles'); |
| 66 | -Route::put('file-links/{id}', 'FileLinks\GuestLinksController@notify') ->name('file-links.show'); |
|
| 67 | -Route::post('file-links/{id}', 'FileLinks\GuestLinksController@update') ->name('file-links.show'); |
|
| 68 | -Route::get('file-links/{id}', 'FileLinks\GuestLinksController@show') ->name('file-links.show'); |
|
| 69 | -Route::get('file-links', 'FileLinks\GuestLinksController@index') ->name('file-links.index'); |
|
| 66 | +Route::put('file-links/{id}', 'FileLinks\GuestLinksController@notify') ->name('file-links.show'); |
|
| 67 | +Route::post('file-links/{id}', 'FileLinks\GuestLinksController@update') ->name('file-links.show'); |
|
| 68 | +Route::get('file-links/{id}', 'FileLinks\GuestLinksController@show') ->name('file-links.show'); |
|
| 69 | +Route::get('file-links', 'FileLinks\GuestLinksController@index') ->name('file-links.index'); |
|
| 70 | 70 | |
| 71 | 71 | /* |
| 72 | 72 | * Customer Routes |
@@ -74,44 +74,44 @@ discard block |
||
| 74 | 74 | Route::prefix('customer')->name('customer.')->group(function() |
| 75 | 75 | { |
| 76 | 76 | // Customer Files |
| 77 | - Route::resource('files', 'Customers\CustomerFilesController'); |
|
| 77 | + Route::resource('files', 'Customers\CustomerFilesController'); |
|
| 78 | 78 | // Custome Notes |
| 79 | - Route::get('download-note/{id}', 'DownloadController@downloadCustNote') ->name('download-note'); |
|
| 80 | - Route::resource('notes', 'Customers\CustomerNotesController'); |
|
| 79 | + Route::get('download-note/{id}', 'DownloadController@downloadCustNote') ->name('download-note'); |
|
| 80 | + Route::resource('notes', 'Customers\CustomerNotesController'); |
|
| 81 | 81 | // Customer Contacts |
| 82 | - Route::resource('contacts', 'Customers\CustomerContactsController'); |
|
| 82 | + Route::resource('contacts', 'Customers\CustomerContactsController'); |
|
| 83 | 83 | // Customer Systems |
| 84 | - Route::resource('systems', 'Customers\CustomerSystemsController'); |
|
| 84 | + Route::resource('systems', 'Customers\CustomerSystemsController'); |
|
| 85 | 85 | // Customer Details |
| 86 | - Route::get('id/{id}/{name}', 'Customers\CustomerDetailsController@details')->name('details'); |
|
| 87 | - Route::resource('id', 'Customers\CustomerDetailsController'); |
|
| 86 | + Route::get('id/{id}/{name}', 'Customers\CustomerDetailsController@details')->name('details'); |
|
| 87 | + Route::resource('id', 'Customers\CustomerDetailsController'); |
|
| 88 | 88 | // check Id and bookmark customer |
| 89 | 89 | Route::get('toggle-fav/{action}/{custID}', 'Customers\CustomerController@toggleFav') ->name('toggle-fav'); |
| 90 | - Route::get('check-id/{id}', 'Customers\CustomerController@checkID') ->name('check-id'); |
|
| 90 | + Route::get('check-id/{id}', 'Customers\CustomerController@checkID') ->name('check-id'); |
|
| 91 | 91 | // Index landing/search page |
| 92 | - Route::get('search', 'Customers\CustomerController@search') ->name('search'); |
|
| 93 | - Route::get('/', 'Customers\CustomerController@index') ->name('index'); |
|
| 92 | + Route::get('search', 'Customers\CustomerController@search') ->name('search'); |
|
| 93 | + Route::get('/', 'Customers\CustomerController@index') ->name('index'); |
|
| 94 | 94 | }); |
| 95 | 95 | |
| 96 | 96 | /* |
| 97 | 97 | * Tech Tip Routes |
| 98 | 98 | */ |
| 99 | -Route::resource('tips', 'TechTips\TechTipsController'); |
|
| 100 | -Route::post('submit-edit/{id}', 'TechTips\TechTipsController@update') ->name('tips.submit-edit'); |
|
| 99 | +Route::resource('tips', 'TechTips\TechTipsController'); |
|
| 100 | +Route::post('submit-edit/{id}', 'TechTips\TechTipsController@update') ->name('tips.submit-edit'); |
|
| 101 | 101 | Route::prefix('tip')->name('tip.')->group(function() |
| 102 | 102 | { |
| 103 | - Route::resource('comments', 'TechTips\TechTipCommentsController'); |
|
| 104 | - Route::get('search', 'TechTips\TechTipsController@search') ->name('search'); |
|
| 105 | - Route::get('details/{id}/{name}', 'TechTips\TechTipsController@details') ->name('details'); |
|
| 106 | - Route::post('process-image', 'TechTips\TechTipsController@processImage')->name('processImage'); |
|
| 103 | + Route::resource('comments', 'TechTips\TechTipCommentsController'); |
|
| 104 | + Route::get('search', 'TechTips\TechTipsController@search') ->name('search'); |
|
| 105 | + Route::get('details/{id}/{name}', 'TechTips\TechTipsController@details') ->name('details'); |
|
| 106 | + Route::post('process-image', 'TechTips\TechTipsController@processImage')->name('processImage'); |
|
| 107 | 107 | Route::get('toggle-fav/{action}/{tipID}', 'TechTips\TechTipsController@toggleFav') ->name('toggle-fav'); |
| 108 | - Route::get('download-tip/{id}', 'DownloadController@downloadTechTip') ->name('downloadTip'); |
|
| 108 | + Route::get('download-tip/{id}', 'DownloadController@downloadTechTip') ->name('downloadTip'); |
|
| 109 | 109 | }); |
| 110 | 110 | |
| 111 | 111 | /* |
| 112 | 112 | * Administration Routes |
| 113 | 113 | */ |
| 114 | -Route::prefix('admin')->name('admin.')->group(function () { |
|
| 114 | +Route::prefix('admin')->name('admin.')->group(function() { |
|
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | |
@@ -138,16 +138,16 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | // Administrative routes for users |
| 141 | - Route::resource('user', 'Admin\UserController'); |
|
| 142 | - Route::get('user/enable/{id}', 'Admin\UserController@reactivateUser') ->name('user.reactivate'); |
|
| 143 | - Route::post('user/change-password', 'Admin\UserController@submitPassword') ->name('user.changePassword'); |
|
| 141 | + Route::resource('user', 'Admin\UserController'); |
|
| 142 | + Route::get('user/enable/{id}', 'Admin\UserController@reactivateUser') ->name('user.reactivate'); |
|
| 143 | + Route::post('user/change-password', 'Admin\UserController@submitPassword') ->name('user.changePassword'); |
|
| 144 | 144 | Route::get('check-user/{name}/{type}', 'Admin\UserController@checkUser') ->name('checkUser'); |
| 145 | - Route::get('links/show/{id}', 'Admin\AdminController@showLinks') ->name('user.showLinks'); |
|
| 146 | - Route::get('links', 'Admin\AdminController@userLinks') ->name('user.links'); |
|
| 147 | - Route::post('password-policy', 'Admin\AdminController@submitPolicy') ->name('passwordPolicy'); |
|
| 148 | - Route::get('password-policy', 'Admin\AdminController@passwordPolicy') ->name('passwordPolicy'); |
|
| 149 | - Route::post('role-policy', 'Admin\AdminController@submitRoleSettings')->name('roleSettings'); |
|
| 150 | - Route::get('role-policy', 'Admin\AdminController@roleSettings') ->name('roleSettings'); |
|
| 145 | + Route::get('links/show/{id}', 'Admin\AdminController@showLinks') ->name('user.showLinks'); |
|
| 146 | + Route::get('links', 'Admin\AdminController@userLinks') ->name('user.links'); |
|
| 147 | + Route::post('password-policy', 'Admin\AdminController@submitPolicy') ->name('passwordPolicy'); |
|
| 148 | + Route::get('password-policy', 'Admin\AdminController@passwordPolicy') ->name('passwordPolicy'); |
|
| 149 | + Route::post('role-policy', 'Admin\AdminController@submitRoleSettings')->name('roleSettings'); |
|
| 150 | + Route::get('role-policy', 'Admin\AdminController@roleSettings') ->name('roleSettings'); |
|
| 151 | 151 | |
| 152 | 152 | // |
| 153 | 153 | |