@@ -25,14 +25,14 @@ |
||
| 25 | 25 | public function boot() |
| 26 | 26 | { |
| 27 | 27 | // Service provider to customize form inputs |
| 28 | - Form::component('bsText', 'components.form.text', ['name', 'label', 'value' => null, 'attributes' => []]); |
|
| 28 | + Form::component('bsText', 'components.form.text', ['name', 'label', 'value' => null, 'attributes' => []]); |
|
| 29 | 29 | Form::component('bsPassword', 'components.form.password', ['name', 'label', 'value' => null, 'attributes' => []]); |
| 30 | - Form::component('bsNumber', 'components.form.number', ['name', 'label', 'value' => null, 'attributes' => []]); |
|
| 31 | - Form::component('bsEmail', 'components.form.email', ['name', 'label', 'value' => null, 'attributes' => []]); |
|
| 32 | - Form::component('bsDate', 'components.form.date', ['name', 'label', 'value' => null, 'attributes' => []]); |
|
| 30 | + Form::component('bsNumber', 'components.form.number', ['name', 'label', 'value' => null, 'attributes' => []]); |
|
| 31 | + Form::component('bsEmail', 'components.form.email', ['name', 'label', 'value' => null, 'attributes' => []]); |
|
| 32 | + Form::component('bsDate', 'components.form.date', ['name', 'label', 'value' => null, 'attributes' => []]); |
|
| 33 | 33 | Form::component('bsTextarea', 'components.form.textarea', ['name', 'label', 'value' => null, 'attributes' => []]); |
| 34 | 34 | Form::component('bsCheckbox', 'components.form.checkbox', ['name', 'label', 'value' => 'on', 'checked' => false, 'attributes' => []]); |
| 35 | - Form::component('bsSelect', 'components.form.select', ['name', 'label', 'list', 'selected' => null, 'attributes' => []]); |
|
| 35 | + Form::component('bsSelect', 'components.form.select', ['name', 'label', 'list', 'selected' => null, 'attributes' => []]); |
|
| 36 | 36 | // Custom Submit button |
| 37 | 37 | Form::component('bsSubmit', 'components.form.submit', ['name']); |
| 38 | 38 | // List of all states in a dropdown box |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | // Determine if a user can see the Administration Nav Link |
| 38 | 38 | public function seeAdminLink(User $user) |
| 39 | 39 | { |
| 40 | - if ($this->isInstaller($user)) |
|
| 40 | + if($this->isInstaller($user)) |
|
| 41 | 41 | { |
| 42 | 42 | return true; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $data = UserRolePermissions::with('UserRolePermissionTypes') |
| 46 | - ->whereHas('UserRolePermissionTypes', function ($query) { |
|
| 46 | + ->whereHas('UserRolePermissionTypes', function($query) { |
|
| 47 | 47 | $query->where('description', 'Manage Users') |
| 48 | 48 | ->orWhere('description', 'Manage User Roles') |
| 49 | 49 | ->orWhere('description', 'Manage Customers') |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | ->get(); |
| 55 | 55 | |
| 56 | 56 | $allow = $data->isEmpty() ? 'Denied' : 'Allowed'; |
| 57 | - Log::debug('User ' . $user->full_name . ' is trying to see admin link. Result - ' . $allow); |
|
| 57 | + Log::debug('User '.$user->full_name.' is trying to see admin link. Result - '.$allow); |
|
| 58 | 58 | |
| 59 | 59 | return $data->isEmpty() ? false : true; |
| 60 | 60 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $data = UserRolePermissions::with('UserRolePermissionTypes') |
| 72 | - ->whereHas('UserRolePermissionTypes', function ($query) use ($task) { |
|
| 72 | + ->whereHas('UserRolePermissionTypes', function($query) use ($task) { |
|
| 73 | 73 | $query->where('description', $task); |
| 74 | 74 | }) |
| 75 | 75 | ->where('role_id', $user->role_id) |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | ->get(); |
| 78 | 78 | |
| 79 | 79 | $allow = $data->isEmpty() ? 'false' : 'true'; |
| 80 | - Log::debug('User '.$user->full_name.' is trying to access '.$task.'. Result - ' . $allow); |
|
| 81 | - if ($allow === 'Denied') |
|
| 80 | + Log::debug('User '.$user->full_name.' is trying to access '.$task.'. Result - '.$allow); |
|
| 81 | + if($allow === 'Denied') |
|
| 82 | 82 | { |
| 83 | - Log::alert('User ' . $user->full_name . ' was denied from accessing '.$task.' link.'); |
|
| 83 | + Log::alert('User '.$user->full_name.' was denied from accessing '.$task.' link.'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | return $data->isEmpty() ? false : true; |
@@ -25,7 +25,8 @@ discard block |
||
| 25 | 25 | // Validate the hash token |
| 26 | 26 | $user = UserInitialize::where('token', $hash)->get(); |
| 27 | 27 | |
| 28 | - if($user->isEmpty()) { |
|
| 28 | + if($user->isEmpty()) |
|
| 29 | + { |
|
| 29 | 30 | Log::warning('Visitor at IP Address '.\Request::ip().' tried to access invalid initialize hash - '.$hash); |
| 30 | 31 | return abort(404); |
| 31 | 32 | } |
@@ -43,7 +44,8 @@ discard block |
||
| 43 | 44 | |
| 44 | 45 | // Verify that the link matches the assigned email address |
| 45 | 46 | $valid = UserInitialize::where('token', $hash)->first(); |
| 46 | - if(empty($valid)) { |
|
| 47 | + if(empty($valid)) |
|
| 48 | + { |
|
| 47 | 49 | Log::warning('Visitor at IP Address '.\Request::ip().' tried to submit an invalid User Initialization link - '.$hash); |
| 48 | 50 | return abort(404); |
| 49 | 51 | } |
@@ -41,7 +41,8 @@ discard block |
||
| 41 | 41 | ]; |
| 42 | 42 | } |
| 43 | 43 | $mods = Module::allDisabled(); |
| 44 | - foreach($mods as $name => $mod) { |
|
| 44 | + foreach($mods as $name => $mod) |
|
| 45 | + { |
|
| 45 | 46 | $moduleList[] = [ |
| 46 | 47 | 'name' => $name, |
| 47 | 48 | 'status' => 'Disabled', |
@@ -78,7 +79,8 @@ discard block |
||
| 78 | 79 | $receiver = new FileReceiver('file', $request, HandlerFactory::classFromRequest($request)); |
| 79 | 80 | |
| 80 | 81 | // Verify that the upload is valid and being processed |
| 81 | - if($receiver->isUploaded() === false) { |
|
| 82 | + if($receiver->isUploaded() === false) |
|
| 83 | + { |
|
| 82 | 84 | Log::error('Upload File Missing - '. |
| 83 | 85 | /** @scrutinizer ignore-type */ |
| 84 | 86 | $request->toArray()); |
@@ -89,7 +91,8 @@ discard block |
||
| 89 | 91 | $save = $receiver->receive(); |
| 90 | 92 | |
| 91 | 93 | // See if the uploade has finished |
| 92 | - if($save->isFinished()) { |
|
| 94 | + if($save->isFinished()) |
|
| 95 | + { |
|
| 93 | 96 | $this->saveFile($save->getFile()); |
| 94 | 97 | |
| 95 | 98 | return 'uploaded successfully'; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | ]); |
| 81 | 81 | |
| 82 | 82 | // Update the site timezone |
| 83 | - if (config('app.timezone') !== $request->timezone) |
|
| 83 | + if(config('app.timezone') !== $request->timezone) |
|
| 84 | 84 | { |
| 85 | 85 | Settings::firstOrCreate( |
| 86 | 86 | ['key' => 'app.timezone'], |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | )->update(['value' => $request->timezone]); |
| 89 | 89 | } |
| 90 | 90 | // Update the maximum file upload size |
| 91 | - if (config('filesystems.paths.max_size') !== $request->filesize) |
|
| 91 | + if(config('filesystems.paths.max_size') !== $request->filesize) |
|
| 92 | 92 | { |
| 93 | 93 | Settings::firstOrCreate( |
| 94 | 94 | ['key' => 'filesystems.paths.max_size'], |
@@ -211,7 +211,8 @@ |
||
| 211 | 211 | public function destroy($id) |
| 212 | 212 | { |
| 213 | 213 | // |
| 214 | - try { |
|
| 214 | + try |
|
| 215 | + { |
|
| 215 | 216 | SystemTypes::find($id)->delete(); |
| 216 | 217 | return response()->json(['success' => true, 'reason' => 'Equipment Successfully Deleted']); |
| 217 | 218 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | // Display all file links |
| 35 | 35 | public function userLinks() |
| 36 | 36 | { |
| 37 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 37 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 38 | 38 | |
| 39 | 39 | $userLinks = new UserCollection( |
| 40 | 40 | User::withCount([ |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | Log::notice('User '.Auth::user()->full_name.' updated User Password Policy requiring resets every '.$request->passExpire.' days'); |
| 95 | 95 | |
| 96 | 96 | // If the setting is changing from never to xx days, update all users |
| 97 | - if ($request->passExpire == 0) |
|
| 97 | + if($request->passExpire == 0) |
|
| 98 | 98 | { |
| 99 | 99 | User::whereNotNull('password_expires')->update([ |
| 100 | 100 | 'password_expires' => null |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | // View the current roles that can be assigned to users |
| 117 | 117 | public function roleSettings() |
| 118 | 118 | { |
| 119 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 119 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 120 | 120 | $this->authorize('hasAccess', 'Manage User Roles'); |
| 121 | 121 | |
| 122 | 122 | $roles = UserRoleType::with(['UserRolePermissions' => function($query) { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | // Show the list of current users to edit |
| 35 | 35 | public function index() |
| 36 | 36 | { |
| 37 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 37 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 38 | 38 | |
| 39 | 39 | $userList = User::with('LastUserLogin')->get()->makeVisible('user_id'); |
| 40 | 40 | $route = 'admin.user.edit'; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | // Show the Add User form |
| 72 | 72 | public function create() |
| 73 | 73 | { |
| 74 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 74 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 75 | 75 | |
| 76 | 76 | $roles = UserRoleType::all(); |
| 77 | 77 | $roleArr = []; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | // List all inactive users |
| 155 | 155 | public function show($type) |
| 156 | 156 | { |
| 157 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 157 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 158 | 158 | $route = ''; |
| 159 | 159 | |
| 160 | 160 | if($type !== 'inactive') |
@@ -177,10 +177,10 @@ discard block |
||
| 177 | 177 | // Reactivate a disabled user |
| 178 | 178 | public function reactivateUser($id) |
| 179 | 179 | { |
| 180 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 180 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 181 | 181 | User::withTrashed()->where('user_id', $id)->restore(); |
| 182 | 182 | |
| 183 | - Log::notice('User ID ' . $id . ' reactivated by ' . Auth::user()->full_name); |
|
| 183 | + Log::notice('User ID '.$id.' reactivated by '.Auth::user()->full_name); |
|
| 184 | 184 | return response()->json([ |
| 185 | 185 | 'success' => true, |
| 186 | 186 | ]); |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | // Open the edit user form |
| 190 | 190 | public function edit($id) |
| 191 | 191 | { |
| 192 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 192 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 193 | 193 | |
| 194 | 194 | $roles = UserRoleType::all(); |
| 195 | 195 | $user = new UserResource(User::findOrFail($id)); |
| 196 | 196 | |
| 197 | 197 | // Make sure that the user is not trying to edit someone with more permissions |
| 198 | - if(($user->role_id == 1 || $user->role_id == 2) && Auth::user()->role_id <=2) |
|
| 198 | + if(($user->role_id == 1 || $user->role_id == 2) && Auth::user()->role_id <= 2) |
|
| 199 | 199 | { |
| 200 | 200 | Log::warning('User '.Auth::user()->full_name.' tried to update user ID '.$id.' that has more permissions than they do. This request was denied.'); |
| 201 | 201 | return abort(403); |
@@ -205,13 +205,13 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | // Good to go - get role information |
| 207 | 207 | $roleArr = []; |
| 208 | - foreach ($roles as $role) |
|
| 208 | + foreach($roles as $role) |
|
| 209 | 209 | { |
| 210 | - if ($role->role_id == 1 && Auth::user()->role_id != 1) |
|
| 210 | + if($role->role_id == 1 && Auth::user()->role_id != 1) |
|
| 211 | 211 | { |
| 212 | 212 | continue; |
| 213 | 213 | } |
| 214 | - else if ($role->role_id == 2 && Auth::user()->role_id > 2) |
|
| 214 | + else if($role->role_id == 2 && Auth::user()->role_id > 2) |
|
| 215 | 215 | { |
| 216 | 216 | continue; |
| 217 | 217 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $user = User::findOrFail($id); |
| 258 | 258 | if($user->role_id < Auth::user()->role_id) |
| 259 | 259 | { |
| 260 | - Log::warning('User ' . Auth::user()->full_name . ' tried to update user ID ' . $id . ' that has more permissions than they do. This request was denied.'); |
|
| 260 | + Log::warning('User '.Auth::user()->full_name.' tried to update user ID '.$id.' that has more permissions than they do. This request was denied.'); |
|
| 261 | 261 | return abort(403); |
| 262 | 262 | } |
| 263 | 263 | |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | $user = User::find($request->user_id); |
| 298 | 298 | |
| 299 | 299 | // Verify this is a valid user ID |
| 300 | - if (!$user) |
|
| 300 | + if(!$user) |
|
| 301 | 301 | { |
| 302 | 302 | $success = false; |
| 303 | 303 | $reason = 'Cannot find user with this ID'; |
| 304 | 304 | } |
| 305 | 305 | // Make sure that the user is not trying to deactivate someone with more permissions |
| 306 | - else if ($user->role_id < Auth::user()->role_id) |
|
| 306 | + else if($user->role_id < Auth::user()->role_id) |
|
| 307 | 307 | { |
| 308 | 308 | $success = false; |
| 309 | 309 | $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.'; |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | // Disable the user |
| 336 | 336 | public function destroy($id) |
| 337 | 337 | { |
| 338 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 338 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 339 | 339 | |
| 340 | 340 | $user = User::find($id); |
| 341 | 341 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function __construct() |
| 17 | 17 | { |
| 18 | 18 | $this->middleware('auth'); |
| 19 | - $this->middleware(function ($request, $next) { |
|
| 19 | + $this->middleware(function($request, $next) { |
|
| 20 | 20 | $this->authorize('hasAccess', 'Manage Customers'); |
| 21 | 21 | return $next($request); |
| 22 | 22 | }); |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | // Form to view what kind of file types can be assigned to customers |
| 51 | 51 | public function fileTypes() |
| 52 | 52 | { |
| 53 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 53 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 54 | 54 | return view('admin.customerFileTypes'); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // Get the types of files that can be assigned to a customer file |
| 58 | 58 | public function getFileTypes() |
| 59 | 59 | { |
| 60 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 60 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 61 | 61 | |
| 62 | 62 | $types = new CustomerFileTypesCollection(CustomerFileTypes::all()); |
| 63 | 63 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | // Submit a new file type name |
| 69 | 69 | public function submitNewFileType(Request $request) |
| 70 | 70 | { |
| 71 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name . '. Submitted Data - ', $request->toArray()); |
|
| 71 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data - ', $request->toArray()); |
|
| 72 | 72 | $request->validate([ |
| 73 | 73 | 'name' => 'required', |
| 74 | 74 | ]); |
@@ -77,14 +77,14 @@ discard block |
||
| 77 | 77 | 'description' => $request->name, |
| 78 | 78 | ]); |
| 79 | 79 | |
| 80 | - Log::notice('New Customer File Type ' . $request->name . ' created by '. Auth::user()->full_name); |
|
| 80 | + Log::notice('New Customer File Type '.$request->name.' created by '.Auth::user()->full_name); |
|
| 81 | 81 | return response()->json(['success' => true]); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Update the name of a file type |
| 85 | 85 | public function setFileTypes(Request $request) |
| 86 | 86 | { |
| 87 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name . '. Submitted Data - ', $request->toArray()); |
|
| 87 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data - ', $request->toArray()); |
|
| 88 | 88 | $request->validate([ |
| 89 | 89 | 'name' => 'required', |
| 90 | 90 | 'id' => 'required|exists:customer_file_types,file_type_id', |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | // Try to delete a file type |
| 102 | 102 | public function delFileType($id) |
| 103 | 103 | { |
| 104 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 104 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 105 | 105 | |
| 106 | 106 | try { |
| 107 | 107 | // Try to delete file type from database - will throw error if foreign key is in use |
| 108 | 108 | CustomerFileTypes::find($id)->delete(); |
| 109 | - } catch (\Illuminate\Database\QueryException $e) { |
|
| 109 | + } catch(\Illuminate\Database\QueryException $e) { |
|
| 110 | 110 | // Unable to remove file type from the database |
| 111 | - Log::warning('Attempt to delete file type ID '.$id.' by User '.Auth::user()->full_name.' failed. Reason - ' . $e); |
|
| 111 | + Log::warning('Attempt to delete file type ID '.$id.' by User '.Auth::user()->full_name.' failed. Reason - '.$e); |
|
| 112 | 112 | return response()->json(['success' => false, 'reason' => 'In Use']); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | // Show all disabled customers |
| 120 | 120 | public function showDisabled() |
| 121 | 121 | { |
| 122 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 122 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 123 | 123 | |
| 124 | 124 | $custList = Customers::select('cust_id', 'name', 'deleted_at') |
| 125 | 125 | ->onlyTrashed() |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | // Re-enable a customer |
| 134 | 134 | public function enableCustomer($id) |
| 135 | 135 | { |
| 136 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 136 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 137 | 137 | |
| 138 | 138 | Customers::withTrashed()->where('cust_id', $id)->restore(); |
| 139 | 139 | |
@@ -103,10 +103,13 @@ |
||
| 103 | 103 | { |
| 104 | 104 | Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
| 105 | 105 | |
| 106 | - try { |
|
| 106 | + try |
|
| 107 | + { |
|
| 107 | 108 | // Try to delete file type from database - will throw error if foreign key is in use |
| 108 | 109 | CustomerFileTypes::find($id)->delete(); |
| 109 | - } catch (\Illuminate\Database\QueryException $e) { |
|
| 110 | + } |
|
| 111 | + catch (\Illuminate\Database\QueryException $e) |
|
| 112 | + { |
|
| 110 | 113 | // Unable to remove file type from the database |
| 111 | 114 | Log::warning('Attempt to delete file type ID '.$id.' by User '.Auth::user()->full_name.' failed. Reason - ' . $e); |
| 112 | 115 | return response()->json(['success' => false, 'reason' => 'In Use']); |