@@ -17,7 +17,8 @@ |
||
17 | 17 | */ |
18 | 18 | public function handle($request, Closure $next, $guard = null) |
19 | 19 | { |
20 | - if(Auth::guard($guard)->check()) { |
|
20 | + if(Auth::guard($guard)->check()) |
|
21 | + { |
|
21 | 22 | return redirect('/dashboard'); |
22 | 23 | } |
23 | 24 |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | $searchResults = new CustomersCollection( |
48 | 48 | Customers::orderBy($request->sortField, $request->sortType) |
49 | 49 | // Search the name, dba name, and cust id columns |
50 | - ->where(function($query) use ($request) |
|
51 | - { |
|
50 | + ->where(function($query) use ($request) { |
|
52 | 51 | $query->where('name', 'like', '%' . $request->name . '%') |
53 | 52 | ->orWhere('cust_id', 'like', '%' . $request->name . '%') |
54 | 53 | ->orWhere('dba_name', 'like', '%' . $request->name . '%'); |
@@ -58,10 +57,8 @@ discard block |
||
58 | 57 | // Include the customers systems |
59 | 58 | ->with('CustomerSystems.SystemTypes') |
60 | 59 | // If the system field is present - search for system type |
61 | - ->when($request->system, function($query) use ($request) |
|
62 | - { |
|
63 | - $query->whereHas('CustomerSystems.SystemTypes', function($query) use ($request) |
|
64 | - { |
|
60 | + ->when($request->system, function($query) use ($request) { |
|
61 | + $query->whereHas('CustomerSystems.SystemTypes', function($query) use ($request) { |
|
65 | 62 | $query->where('sys_id', $request->system); |
66 | 63 | }); |
67 | 64 | }) |
@@ -62,8 +62,7 @@ discard block |
||
62 | 62 | /* |
63 | 63 | * Customer Routes |
64 | 64 | */ |
65 | -Route::prefix('customer')->name('customer.')->group(function() |
|
66 | -{ |
|
65 | +Route::prefix('customer')->name('customer.')->group(function() { |
|
67 | 66 | // Customer Files |
68 | 67 | Route::resource('files', 'Customers\CustomerFilesController'); |
69 | 68 | // Custome Notes |
@@ -89,8 +88,7 @@ discard block |
||
89 | 88 | */ |
90 | 89 | Route::resource('tips', 'TechTips\TechTipsController'); |
91 | 90 | Route::post('submit-edit/{id}', 'TechTips\TechTipsController@update') ->name('tips.submit-edit'); |
92 | -Route::prefix('tip')->name('tip.')->group(function() |
|
93 | -{ |
|
91 | +Route::prefix('tip')->name('tip.')->group(function() { |
|
94 | 92 | Route::resource('comments', 'TechTips\TechTipCommentsController'); |
95 | 93 | Route::get('search', 'TechTips\TechTipsController@search') ->name('search'); |
96 | 94 | Route::get('details/{id}/{name}', 'TechTips\TechTipsController@details') ->name('details'); |
@@ -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 | }); |
@@ -135,7 +135,8 @@ discard block |
||
135 | 135 | // Validate the hash token |
136 | 136 | $user = UserInitialize::where('token', $hash)->get(); |
137 | 137 | |
138 | - if ($user->isEmpty()) { |
|
138 | + if ($user->isEmpty()) |
|
139 | + { |
|
139 | 140 | Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
140 | 141 | Log::warning('Visitor at IP Address ' . \Request::ip() . ' tried to access invalid initialize hash - ' . $hash); |
141 | 142 | return abort(404); |
@@ -151,7 +152,8 @@ discard block |
||
151 | 152 | { |
152 | 153 | // Verify that the link matches the assigned email address |
153 | 154 | $valid = UserInitialize::where('token', $hash)->first(); |
154 | - if (empty($valid)) { |
|
155 | + if (empty($valid)) |
|
156 | + { |
|
155 | 157 | Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
156 | 158 | Log::warning('Visitor at IP Address ' . \Request::ip() . ' tried to submit an invalid User Initialization link - ' . $hash); |
157 | 159 | return abort(404); |
@@ -12,8 +12,7 @@ |
||
12 | 12 | public function run() |
13 | 13 | { |
14 | 14 | // Create the test users - note, none are installers - permissions are assigned randomly |
15 | - factory(App\User::class, 15)->create()->each(function($user) |
|
16 | - { |
|
15 | + factory(App\User::class, 15)->create()->each(function($user) { |
|
17 | 16 | // $user->UserPermissions()->save(factory(App\UserPermissions::class)->create(['user_id' => $user->user_id])); |
18 | 17 | }); |
19 | 18 | } |
@@ -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(); |
@@ -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 | [ |
@@ -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 | } |