@@ -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, |
@@ -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 | } |
@@ -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 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function __construct() |
31 | 31 | { |
32 | 32 | $this->middleware('auth')->except('initializeUser', 'submitInitializeUser'); |
33 | - $this->middleware(function ($request, $next) { |
|
33 | + $this->middleware(function($request, $next) { |
|
34 | 34 | $this->authorize('hasAccess', 'Manage Users'); |
35 | 35 | return $next($request); |
36 | 36 | }); |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | // Show the list of current users to edit |
40 | 40 | public function index() |
41 | 41 | { |
42 | - $userList = new UserCollection(User::with(['UserLogins' => function ($query) { |
|
42 | + $userList = new UserCollection(User::with(['UserLogins' => function($query) { |
|
43 | 43 | $query->latest()->limit(1); |
44 | 44 | }])->get() |
45 | 45 | /** @scrutinizer ignore-call */ |
46 | 46 | ->makeVisible('user_id')); |
47 | - $route = 'admin.user.edit'; |
|
47 | + $route = 'admin.user.edit'; |
|
48 | 48 | |
49 | 49 | return view('admin.userIndex', [ |
50 | 50 | 'userList' => $userList, |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | // Validate the new user form |
108 | 108 | $request->validate([ |
109 | - 'role' => 'required|numeric', // TODO - add validation rule - is in user roles table |
|
109 | + 'role' => 'required|numeric', // TODO - add validation rule - is in user roles table |
|
110 | 110 | 'username' => 'required|unique:users|regex:/^[a-zA-Z0-9_]*$/', |
111 | 111 | 'first_name' => 'required', |
112 | 112 | 'last_name' => 'required', |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | // List all inactive users |
148 | 148 | public function show($type) |
149 | 149 | { |
150 | - $route = ''; |
|
150 | + $route = ''; |
|
151 | 151 | |
152 | 152 | if($type !== 'inactive') |
153 | 153 | { |
@@ -171,17 +171,17 @@ discard block |
||
171 | 171 | $user = new UserResource(User::findOrFail($id)); |
172 | 172 | |
173 | 173 | // Make sure that the user is not trying to deactivate someone with more permissions |
174 | - if ($user->role_id < Auth::user()->role_id) |
|
174 | + if($user->role_id < Auth::user()->role_id) |
|
175 | 175 | { |
176 | 176 | return abort(403); |
177 | 177 | } |
178 | 178 | |
179 | 179 | // Good to go - update user password |
180 | 180 | $roleArr = []; |
181 | - foreach ($roles as $role) { |
|
182 | - if ($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
181 | + foreach($roles as $role) { |
|
182 | + if($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
183 | 183 | continue; |
184 | - } else if ($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
184 | + } else if($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
185 | 185 | continue; |
186 | 186 | } else { |
187 | 187 | // $roleArr[$role->role_id] = $role->name; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
|
195 | + Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
196 | 196 | return view('admin.userEdit', [ |
197 | 197 | 'roles' => $roleArr, |
198 | 198 | 'user' => $user-> |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | // Update the user data |
232 | 232 | $user = User::findOrFail($id); |
233 | 233 | |
234 | - if ($user->role_id < Auth::user()->role_id) |
|
234 | + if($user->role_id < Auth::user()->role_id) |
|
235 | 235 | { |
236 | 236 | return abort(403); |
237 | 237 | } |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | $user = User::find($request->user_id); |
275 | 275 | |
276 | 276 | // Verify this is a valid user ID |
277 | - if (!$user) { |
|
277 | + if(!$user) { |
|
278 | 278 | $success = false; |
279 | 279 | $reason = 'Cannot find user with this ID'; |
280 | 280 | } |
281 | 281 | // Make sure that the user is not trying to deactivate someone with more permissions |
282 | - else if ($user->role_id < Auth::user()->role_id) { |
|
282 | + else if($user->role_id < Auth::user()->role_id) { |
|
283 | 283 | $success = false; |
284 | 284 | $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.'; |
285 | 285 | } |
@@ -292,11 +292,11 @@ discard block |
||
292 | 292 | 'password_expires' => $nextChange |
293 | 293 | ]); |
294 | 294 | $success = true; |
295 | - $reason = 'Password for ' . $user->full_name . ' successfully reset.'; |
|
295 | + $reason = 'Password for '.$user->full_name.' successfully reset.'; |
|
296 | 296 | } |
297 | 297 | |
298 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
|
299 | - Log::notice('User ID-' . $request->user_id . ' password chagned by ' . Auth::user()->user_id, [ |
|
298 | + Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id); |
|
299 | + Log::notice('User ID-'.$request->user_id.' password chagned by '.Auth::user()->user_id, [ |
|
300 | 300 | 'success' => $success, |
301 | 301 | 'reason' => $reason, |
302 | 302 | ]); |
@@ -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 | |
@@ -132,21 +132,21 @@ discard block |
||
132 | 132 | |
133 | 133 | // Administrative routes for equipment and equipment categories |
134 | 134 | Route::resource('categories', 'Installer\CategoriesController'); |
135 | - Route::resource('systems', 'Installer\SystemsController'); |
|
135 | + Route::resource('systems', 'Installer\SystemsController'); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | |
139 | 139 | // Administrative routes for users |
140 | - Route::resource('user', 'Admin\UserController'); |
|
141 | - Route::get('user/enable/{id}', 'Admin\UserController@reactivateUser') ->name('user.reactivate'); |
|
142 | - Route::post('user/change-password', 'Admin\UserController@submitPassword') ->name('user.changePassword'); |
|
140 | + Route::resource('user', 'Admin\UserController'); |
|
141 | + Route::get('user/enable/{id}', 'Admin\UserController@reactivateUser') ->name('user.reactivate'); |
|
142 | + Route::post('user/change-password', 'Admin\UserController@submitPassword') ->name('user.changePassword'); |
|
143 | 143 | Route::get('check-user/{name}/{type}', 'Admin\UserController@checkUser') ->name('checkUser'); |
144 | - Route::get('links/show/{id}', 'Admin\AdminController@showLinks') ->name('user.showLinks'); |
|
145 | - Route::get('links', 'Admin\AdminController@userLinks') ->name('user.links'); |
|
146 | - Route::post('password-policy', 'Admin\AdminController@submitPolicy') ->name('passwordPolicy'); |
|
147 | - Route::get('password-policy', 'Admin\AdminController@passwordPolicy') ->name('passwordPolicy'); |
|
148 | - Route::post('role-policy', 'Admin\AdminController@submitRoleSettings')->name('roleSettings'); |
|
149 | - Route::get('role-policy', 'Admin\AdminController@roleSettings') ->name('roleSettings'); |
|
144 | + Route::get('links/show/{id}', 'Admin\AdminController@showLinks') ->name('user.showLinks'); |
|
145 | + Route::get('links', 'Admin\AdminController@userLinks') ->name('user.links'); |
|
146 | + Route::post('password-policy', 'Admin\AdminController@submitPolicy') ->name('passwordPolicy'); |
|
147 | + Route::get('password-policy', 'Admin\AdminController@passwordPolicy') ->name('passwordPolicy'); |
|
148 | + Route::post('role-policy', 'Admin\AdminController@submitRoleSettings')->name('roleSettings'); |
|
149 | + Route::get('role-policy', 'Admin\AdminController@roleSettings') ->name('roleSettings'); |
|
150 | 150 | |
151 | 151 | // |
152 | 152 |