@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | |
30 | 30 | // Determine if the note should go to the customer, or its parent |
31 | 31 | $details = Customers::find($request->cust_id); |
32 | - if ($details->parent_id && $request->shared) { |
|
32 | + if ($details->parent_id && $request->shared) |
|
33 | + { |
|
33 | 34 | $request->cust_id = $details->parent_id; |
34 | 35 | } |
35 | 36 | |
@@ -55,7 +56,8 @@ discard block |
||
55 | 56 | |
56 | 57 | // Determine if there is a parent site with shared contacts |
57 | 58 | $parent = Customers::find($id)->parent_id; |
58 | - if ($parent) { |
|
59 | + if ($parent) |
|
60 | + { |
|
59 | 61 | $parentList = CustomerNotes::where('cust_id', $parent)->orderBy('urgent', 'desc')->get(); |
60 | 62 | |
61 | 63 | $notes = $notes->merge($parentList); |
@@ -110,7 +110,8 @@ |
||
110 | 110 | |
111 | 111 | // Determine if there is a parent site with shared files |
112 | 112 | $parent = Customers::find($id)->parent_id; |
113 | - if ($parent) { |
|
113 | + if ($parent) |
|
114 | + { |
|
114 | 115 | $parentList = Customerfiles::where('cust_id', $parent) |
115 | 116 | ->with('Files') |
116 | 117 | ->with('CustomerFileTypes') |
@@ -83,7 +83,8 @@ discard block |
||
83 | 83 | // Added the ability to set an expiration date for user passwords - will force them to change after this expires |
84 | 84 | private function addPasswordExpiresColumn() |
85 | 85 | { |
86 | - if(!Schema::hasColumn('users', 'password_expires')) { |
|
86 | + if(!Schema::hasColumn('users', 'password_expires')) |
|
87 | + { |
|
87 | 88 | Schema::table('users', function(Blueprint $table) { |
88 | 89 | $table->timestamp('password_expires') |
89 | 90 | ->nullable() |
@@ -119,7 +120,8 @@ discard block |
||
119 | 120 | // Added a 'hidden' attribute to system customer data types to allow passwords to not be viewed unless clicked or focus |
120 | 121 | private function addHiddenColumn() |
121 | 122 | { |
122 | - if(!Schema::hasColumn('system_data_field_types', 'hidden')) { |
|
123 | + if(!Schema::hasColumn('system_data_field_types', 'hidden')) |
|
124 | + { |
|
123 | 125 | Schema::table('system_cust_data_types', function(Blueprint $table) { |
124 | 126 | $table->boolean('hidden') |
125 | 127 | ->default(0) |
@@ -131,7 +133,8 @@ discard block |
||
131 | 133 | // Update the File links table - add cust_id and note column |
132 | 134 | private function addColumnsToFileLinksTable() |
133 | 135 | { |
134 | - if(!Schema::hasColumn('file_links', 'cust_id')) { |
|
136 | + if(!Schema::hasColumn('file_links', 'cust_id')) |
|
137 | + { |
|
135 | 138 | Schema::table('file_links', function(Blueprint $table) { |
136 | 139 | $table->integer('cust_id') |
137 | 140 | ->unsigned() |
@@ -140,7 +143,8 @@ discard block |
||
140 | 143 | $table->foreign('cust_id')->references('cust_id')->on('customers')->onUpdate('cascade')->onDelete('cascade'); |
141 | 144 | }); |
142 | 145 | } |
143 | - if(!Schema::hasColumn('file_links', 'note')) { |
|
146 | + if(!Schema::hasColumn('file_links', 'note')) |
|
147 | + { |
|
144 | 148 | Schema::table('file_links', function(Blueprint $table) { |
145 | 149 | $table->longText('note') |
146 | 150 | ->nullable() |
@@ -148,7 +152,8 @@ discard block |
||
148 | 152 | }); |
149 | 153 | // Migrate the instructions from the old table to the new column |
150 | 154 | $instructions = DB::select('SELECT * FROM `file_link_instructions`'); |
151 | - foreach($instructions as $ins) { |
|
155 | + foreach($instructions as $ins) |
|
156 | + { |
|
152 | 157 | FileLinks::find($ins->link_id)->update([ |
153 | 158 | 'note' => $ins->instruction |
154 | 159 | ]); |
@@ -159,7 +164,8 @@ discard block |
||
159 | 164 | // Add Notes column to the file links files table |
160 | 165 | private function addNotesColumnToFileLinkFiles() |
161 | 166 | { |
162 | - if(!Schema::hasColumn('file_link_files', 'note')) { |
|
167 | + if(!Schema::hasColumn('file_link_files', 'note')) |
|
168 | + { |
|
163 | 169 | Schema::table('file_link_files', function(Blueprint $table) { |
164 | 170 | $table->longText('note') |
165 | 171 | ->nullable() |
@@ -167,7 +173,8 @@ discard block |
||
167 | 173 | }); |
168 | 174 | // Migrate the existing notes to the new table |
169 | 175 | $notes = DB::select('SELECT * FROM `file_link_notes`'); |
170 | - foreach($notes as $note) { |
|
176 | + foreach($notes as $note) |
|
177 | + { |
|
171 | 178 | FileLinkFiles::where('file_id', $note->file_id)->update([ |
172 | 179 | 'note' => $note->note |
173 | 180 | ]); |
@@ -178,7 +185,8 @@ discard block |
||
178 | 185 | // Add the documentation column to the tech tips table |
179 | 186 | private function migrateSystemDocumentation() |
180 | 187 | { |
181 | - if(!Schema::hasColumn('tech_tips', 'tip_type_id')) { |
|
188 | + if(!Schema::hasColumn('tech_tips', 'tip_type_id')) |
|
189 | + { |
|
182 | 190 | Schema::table('tech_tips', function(Blueprint $table) { |
183 | 191 | $table->bigInteger('tip_type_id')->unsigned()->after('public')->default(1); |
184 | 192 | $table->foreign('tip_type_id')->references('tip_type_id')->on('tech_tip_types')->onUpdate('cascade'); |
@@ -186,7 +194,8 @@ discard block |
||
186 | 194 | |
187 | 195 | // Move all of the system files over to the tech tips table |
188 | 196 | $sysFiles = DB::select('SELECT * FROM `system_files`'); |
189 | - foreach($sysFiles as $sysFile) { |
|
197 | + foreach($sysFiles as $sysFile) |
|
198 | + { |
|
190 | 199 | $newTip = TechTips::create([ |
191 | 200 | 'user_id' => $sysFile->user_id, |
192 | 201 | 'public' => 0, |
@@ -280,7 +289,8 @@ discard block |
||
280 | 289 | // Remove the system files and system file types table |
281 | 290 | private function removeSystemFilesTables() |
282 | 291 | { |
283 | - if(Schema::hasTable('system_files')) { |
|
292 | + if(Schema::hasTable('system_files')) |
|
293 | + { |
|
284 | 294 | Schema::table('system_files', function(Blueprint $table) { |
285 | 295 | $table->dropForeign(['sys_id']); |
286 | 296 | $table->dropForeign(['type_id']); |
@@ -326,7 +336,8 @@ discard block |
||
326 | 336 | // Add soft deletes to tech tips table to prevent accidental deletes |
327 | 337 | private function addSoftDeleteToTechTips() |
328 | 338 | { |
329 | - if (!Schema::hasColumn('tech_tips', 'deleted_at')) { |
|
339 | + if (!Schema::hasColumn('tech_tips', 'deleted_at')) |
|
340 | + { |
|
330 | 341 | Schema::table('tech_tips', function (Blueprint $table) { |
331 | 342 | $table->softDeletes()->after('description'); |
332 | 343 | }); |
@@ -338,8 +349,7 @@ discard block |
||
338 | 349 | { |
339 | 350 | if(!Schema::hasColumn('users', 'deleted_at')) |
340 | 351 | { |
341 | - Schema::table('users', function(Blueprint $table) |
|
342 | - { |
|
352 | + Schema::table('users', function(Blueprint $table) { |
|
343 | 353 | $table->softDeletes()->after('password_expires'); |
344 | 354 | }); |
345 | 355 | // Migrate over all deactivated users |
@@ -356,34 +366,31 @@ discard block |
||
356 | 366 | { |
357 | 367 | if(!Schema::hasColumn('customers', 'parent_id')) |
358 | 368 | { |
359 | - Schema::table('customers', function(Blueprint $table) |
|
360 | - { |
|
369 | + Schema::table('customers', function(Blueprint $table) { |
|
361 | 370 | $table->integer('parent_id')->after('cust_id')->nullable()->unsigned(); |
362 | 371 | $table->foreign('parent_id')->references('cust_id')->on('customers')->onUpdate('cascade'); |
363 | 372 | }); |
364 | 373 | } |
365 | 374 | if(!Schema::hasColumn('customer_systems', 'shared')) |
366 | 375 | { |
367 | - Schema::table('customer_systems', function (Blueprint $table) |
|
368 | - { |
|
376 | + Schema::table('customer_systems', function (Blueprint $table) { |
|
369 | 377 | $table->boolean('shared')->default(0)->after('sys_id'); |
370 | 378 | }); |
371 | 379 | } |
372 | 380 | if (!Schema::hasColumn('customer_contacts', 'shared')) |
373 | 381 | { |
374 | - Schema::table('customer_contacts', function (Blueprint $table) |
|
375 | - { |
|
382 | + Schema::table('customer_contacts', function (Blueprint $table) { |
|
376 | 383 | $table->boolean('shared')->default(0)->after('cust_id'); |
377 | 384 | }); |
378 | 385 | } |
379 | 386 | if (!Schema::hasColumn('customer_notes', 'shared')) |
380 | 387 | { |
381 | - Schema::table('customer_notes', function (Blueprint $table) |
|
382 | - { |
|
388 | + Schema::table('customer_notes', function (Blueprint $table) { |
|
383 | 389 | $table->boolean('shared')->default(0)->after('user_id'); |
384 | 390 | }); |
385 | 391 | } |
386 | - if (!Schema::hasColumn('customer_files', 'shared')) { |
|
392 | + if (!Schema::hasColumn('customer_files', 'shared')) |
|
393 | + { |
|
387 | 394 | Schema::table('customer_files', function (Blueprint $table) { |
388 | 395 | $table->boolean('shared')->default(0)->after('user_id'); |
389 | 396 | }); |