@@ -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 | [ |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function __construct() |
30 | 30 | { |
31 | 31 | $this->middleware('auth')->except('initializeUser', 'submitInitializeUser'); |
32 | - $this->middleware(function ($request, $next) { |
|
32 | + $this->middleware(function($request, $next) { |
|
33 | 33 | $this->authorize('hasAccess', 'Manage Users'); |
34 | 34 | return $next($request); |
35 | 35 | }); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // List all inactive users |
145 | 145 | public function show($type) |
146 | 146 | { |
147 | - $route = ''; |
|
147 | + $route = ''; |
|
148 | 148 | |
149 | 149 | if($type !== 'inactive') |
150 | 150 | { |
@@ -168,17 +168,17 @@ discard block |
||
168 | 168 | $user = new UserResource(User::findOrFail($id)); |
169 | 169 | |
170 | 170 | // Make sure that the user is not trying to deactivate someone with more permissions |
171 | - if ($user->role_id < Auth::user()->role_id) |
|
171 | + if($user->role_id < Auth::user()->role_id) |
|
172 | 172 | { |
173 | 173 | return abort(403); |
174 | 174 | } |
175 | 175 | |
176 | 176 | // Good to go - update user password |
177 | 177 | $roleArr = []; |
178 | - foreach ($roles as $role) { |
|
179 | - if ($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
178 | + foreach($roles as $role) { |
|
179 | + if($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
180 | 180 | continue; |
181 | - } else if ($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
181 | + } else if($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
182 | 182 | continue; |
183 | 183 | } else { |
184 | 184 | // $roleArr[$role->role_id] = $role->name; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
|
192 | + Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
193 | 193 | return view('admin.userEdit', [ |
194 | 194 | 'roles' => $roleArr, |
195 | 195 | 'user' => $user-> |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | // Update the user data |
229 | 229 | $user = User::findOrFail($id); |
230 | 230 | |
231 | - if ($user->role_id < Auth::user()->role_id) |
|
231 | + if($user->role_id < Auth::user()->role_id) |
|
232 | 232 | { |
233 | 233 | return abort(403); |
234 | 234 | } |
@@ -271,12 +271,12 @@ discard block |
||
271 | 271 | $user = User::find($request->user_id); |
272 | 272 | |
273 | 273 | // Verify this is a valid user ID |
274 | - if (!$user) { |
|
274 | + if(!$user) { |
|
275 | 275 | $success = false; |
276 | 276 | $reason = 'Cannot find user with this ID'; |
277 | 277 | } |
278 | 278 | // Make sure that the user is not trying to deactivate someone with more permissions |
279 | - else if ($user->role_id < Auth::user()->role_id) { |
|
279 | + else if($user->role_id < Auth::user()->role_id) { |
|
280 | 280 | $success = false; |
281 | 281 | $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.'; |
282 | 282 | } |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | 'password_expires' => $nextChange |
290 | 290 | ]); |
291 | 291 | $success = true; |
292 | - $reason = 'Password for ' . $user->full_name . ' successfully reset.'; |
|
292 | + $reason = 'Password for '.$user->full_name.' successfully reset.'; |
|
293 | 293 | } |
294 | 294 | |
295 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
|
296 | - Log::notice('User ID-' . $request->user_id . ' password chagned by ' . Auth::user()->user_id, [ |
|
295 | + Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
296 | + Log::notice('User ID-'.$request->user_id.' password chagned by '.Auth::user()->user_id, [ |
|
297 | 297 | 'success' => $success, |
298 | 298 | 'reason' => $reason, |
299 | 299 | ]); |
@@ -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 | } |
@@ -77,7 +77,8 @@ |
||
77 | 77 | // Delete an existing category - note this will fail if the category has systems assigned to it |
78 | 78 | public function destroy($id) |
79 | 79 | { |
80 | - try { |
|
80 | + try |
|
81 | + { |
|
81 | 82 | SystemCategories::find($id)->delete(); |
82 | 83 | return response()->json(['success' => true, 'reason' => 'Category Successfully Deleted']); |
83 | 84 | } |
@@ -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', |
@@ -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(UserRolePermissions::class, function () { |
|
8 | +$factory->define(UserRolePermissions::class, function() { |
|
9 | 9 | return [ |
10 | 10 | // |
11 | 11 | 'role_id' => factory(App\UserRoleType::class)->create()->role_id, |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | // Delete an existing system - note this will fail if the system has any customers or tech tips assigned to it |
212 | - public function destroy($id) |
|
213 | - { |
|
214 | - // |
|
215 | - try { |
|
212 | + public function destroy($id) |
|
213 | + { |
|
214 | + // |
|
215 | + try { |
|
216 | 216 | SystemTypes::find($id)->delete(); |
217 | 217 | return response()->json(['success' => true, 'reason' => 'Equipment Successfully Deleted']); |
218 | 218 | } |
@@ -220,5 +220,5 @@ discard block |
||
220 | 220 | { |
221 | 221 | return response()->json(['success' => false, 'reason' => 'Cannot delete this equipment. It has Customers or Tech Tips assigned to it. Please delete those first.']); |
222 | 222 | } |
223 | - } |
|
223 | + } |
|
224 | 224 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | public function __construct() |
19 | 19 | { |
20 | 20 | $this->middleware('auth'); |
21 | - $this->middleware(function ($request, $next) { |
|
21 | + $this->middleware(function($request, $next) { |
|
22 | 22 | $this->authorize('hasAccess', 'Manage Equipment'); |
23 | 23 | return $next($request); |
24 | 24 | }); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $fields = SystemDataFieldTypes::all(); |
121 | 121 | $cat = SystemCategories::where('name', str_replace('-', ' ', $cat))->first(); |
122 | 122 | |
123 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
|
123 | + Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
124 | 124 | return view('installer.newSystem', [ |
125 | 125 | 'cat' => $cat, |
126 | 126 | 'dataList' => $fields, |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $query->join('system_data_field_types', 'system_data_fields.data_type_id', '=', 'system_data_field_types.data_type_id'); |
137 | 137 | }])->withCount('SystemDataFields')->first(); |
138 | 138 | |
139 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
|
139 | + Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
140 | 140 | return view('installer.editSystem', [ |
141 | 141 | 'system' => $system, |
142 | 142 | 'dataList' => $fields, |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | SystemTypes::find($id)->delete(); |
217 | 217 | return response()->json(['success' => true, 'reason' => 'Equipment Successfully Deleted']); |
218 | 218 | } |
219 | - catch (\Illuminate\Database\QueryException $e) |
|
219 | + catch(\Illuminate\Database\QueryException $e) |
|
220 | 220 | { |
221 | 221 | return response()->json(['success' => false, 'reason' => 'Cannot delete this equipment. It has Customers or Tech Tips assigned to it. Please delete those first.']); |
222 | 222 | } |
@@ -131,8 +131,7 @@ discard block |
||
131 | 131 | public function edit($id) |
132 | 132 | { |
133 | 133 | $fields = SystemDataFieldTypes::all(); |
134 | - $system = SystemTypes::where('sys_id', $id)->with(['SystemDataFields' => function($query) |
|
135 | - { |
|
134 | + $system = SystemTypes::where('sys_id', $id)->with(['SystemDataFields' => function($query) { |
|
136 | 135 | $query->join('system_data_field_types', 'system_data_fields.data_type_id', '=', 'system_data_field_types.data_type_id'); |
137 | 136 | }])->withCount('SystemDataFields')->first(); |
138 | 137 | |
@@ -212,7 +211,8 @@ discard block |
||
212 | 211 | public function destroy($id) |
213 | 212 | { |
214 | 213 | // |
215 | - try { |
|
214 | + try |
|
215 | + { |
|
216 | 216 | SystemTypes::find($id)->delete(); |
217 | 217 | return response()->json(['success' => true, 'reason' => 'Equipment Successfully Deleted']); |
218 | 218 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | if(Auth::user()->password_expires !== null) |
26 | 26 | { |
27 | 27 | $passExp = new Carbon((Auth::user()->password_expires)); |
28 | - if(Carbon::now() > $passExp ) |
|
28 | + if(Carbon::now() > $passExp) |
|
29 | 29 | { |
30 | 30 | Log::notice('User ID-'.Auth::user()->user_id.' is being forced to change their password.'); |
31 | 31 | $request->session()->flash('change_password', 'change_password'); |
@@ -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', [ |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | )->update(['value' => $request->passExpire]); |
89 | 89 | |
90 | 90 | // If the setting is changing from never to xx days, update all users |
91 | - if ($request->passExpire == 0) { |
|
91 | + if($request->passExpire == 0) { |
|
92 | 92 | User::whereNotNull('password_expires')->update([ |
93 | 93 | 'password_expires' => null |
94 | 94 | ]); |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | ]); |
102 | 102 | } |
103 | 103 | |
104 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
|
104 | + Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
105 | 105 | Log::debug('Submitted Data - ', $request->toArray()); |
106 | - Log::notice('User Settings have been changed by User ID-' . Auth::user()->user_id); |
|
106 | + Log::notice('User Settings have been changed by User ID-'.Auth::user()->user_id); |
|
107 | 107 | return redirect()->back()->with('success', 'User Security Updated'); |
108 | 108 | } |
109 | 109 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'name' => $request->name, |
163 | 163 | 'description' => $request->description, |
164 | 164 | ]); |
165 | - foreach ($request->permissions as $perm) |
|
165 | + foreach($request->permissions as $perm) |
|
166 | 166 | { |
167 | 167 | UserRolePermissions::create([ |
168 | 168 | '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 | ]) |
@@ -88,7 +87,8 @@ discard block |
||
88 | 87 | )->update(['value' => $request->passExpire]); |
89 | 88 | |
90 | 89 | // If the setting is changing from never to xx days, update all users |
91 | - if ($request->passExpire == 0) { |
|
90 | + if ($request->passExpire == 0) |
|
91 | + { |
|
92 | 92 | User::whereNotNull('password_expires')->update([ |
93 | 93 | 'password_expires' => null |
94 | 94 | ]); |
@@ -110,8 +110,7 @@ discard block |
||
110 | 110 | public function roleSettings() |
111 | 111 | { |
112 | 112 | $this->authorize('hasAccess', 'Manage User Roles'); |
113 | - $roles = UserRoleType::with(['UserRolePermissions' => function($query) |
|
114 | - { |
|
113 | + $roles = UserRoleType::with(['UserRolePermissions' => function($query) { |
|
115 | 114 | $query->join('user_role_permission_types', 'user_role_permission_types.perm_type_id', '=', 'user_role_permissions.perm_type_id'); |
116 | 115 | }])->get(); |
117 | 116 | $perms = UserRolePermissionTypes::all(); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
74 | 74 | Log::notice('New Customer ID-'.$request->custID.' created by User ID-'.Auth::user()->user_id); |
75 | 75 | |
76 | - return response()->json(['success' => true, 'cust_id' => $custData->cust_id ]); |
|
76 | + return response()->json(['success' => true, 'cust_id' => $custData->cust_id]); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Show the customer details |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | $parentsParent = Customers::find($request->parent_id); |
144 | 144 | |
145 | - if ($parentsParent->parent_id) |
|
145 | + if($parentsParent->parent_id) |
|
146 | 146 | { |
147 | 147 | $request->parent_id = $parentsParent->parent_id; |
148 | 148 | } |