@@ -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', |
@@ -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(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 | } |