@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | // Added the ability to set an expiration date for user passwords - will force them to change after this expires |
81 | 81 | private function addPasswordExpiresColumn() |
82 | 82 | { |
83 | - if (!Schema::hasColumn('users', 'password_expires')) { |
|
84 | - Schema::table('users', function (Blueprint $table) { |
|
83 | + if(!Schema::hasColumn('users', 'password_expires')) { |
|
84 | + Schema::table('users', function(Blueprint $table) { |
|
85 | 85 | $table->timestamp('password_expires') |
86 | 86 | ->nullable() |
87 | 87 | ->after('active'); |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | // Add the is installer column to the users table |
93 | 93 | private function addIsInstallerToUsers() |
94 | 94 | { |
95 | - if (!Schema::hasColumn('users', 'is_installer')) |
|
95 | + if(!Schema::hasColumn('users', 'is_installer')) |
|
96 | 96 | { |
97 | 97 | // Add the is installer column |
98 | - Schema::table('users', function (Blueprint $table) { |
|
98 | + Schema::table('users', function(Blueprint $table) { |
|
99 | 99 | $table->boolean('is_installer')->default(0)->after('active'); |
100 | 100 | }); |
101 | 101 | // Make user id 1 the installer user |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $permissions = UserPermissions::all(); |
121 | 121 | |
122 | 122 | // Cycle thorugh all users and assign proper permissions |
123 | - foreach ($userRoles as $user) |
|
123 | + foreach($userRoles as $user) |
|
124 | 124 | { |
125 | 125 | $userPerm = $defaultPermissions; |
126 | 126 | if(!$permissions->contains($user->user_id)) |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | // Added a 'hidden' attribute to system customer data types to allow passwords to not be viewed unless clicked or focus |
151 | 151 | private function addHiddenColumn() |
152 | 152 | { |
153 | - if (!Schema::hasColumn('system_data_field_types', 'hidden')) { |
|
154 | - Schema::table('system_cust_data_types', function (Blueprint $table) { |
|
153 | + if(!Schema::hasColumn('system_data_field_types', 'hidden')) { |
|
154 | + Schema::table('system_cust_data_types', function(Blueprint $table) { |
|
155 | 155 | $table->boolean('hidden') |
156 | 156 | ->default(0) |
157 | 157 | ->after('name'); |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | // Update the File links table - add cust_id and note column |
163 | 163 | private function addColumnsToFileLinksTable() |
164 | 164 | { |
165 | - if (!Schema::hasColumn('file_links', 'cust_id')) { |
|
166 | - Schema::table('file_links', function (Blueprint $table) { |
|
165 | + if(!Schema::hasColumn('file_links', 'cust_id')) { |
|
166 | + Schema::table('file_links', function(Blueprint $table) { |
|
167 | 167 | $table->integer('cust_id') |
168 | 168 | ->unsigned() |
169 | 169 | ->nullable() |
@@ -171,15 +171,15 @@ discard block |
||
171 | 171 | $table->foreign('cust_id')->references('cust_id')->on('customers')->onUpdate('cascade')->onDelete('cascade'); |
172 | 172 | }); |
173 | 173 | } |
174 | - if (!Schema::hasColumn('file_links', 'note')) { |
|
175 | - Schema::table('file_links', function (Blueprint $table) { |
|
174 | + if(!Schema::hasColumn('file_links', 'note')) { |
|
175 | + Schema::table('file_links', function(Blueprint $table) { |
|
176 | 176 | $table->longText('note') |
177 | 177 | ->nullable() |
178 | 178 | ->after('link_name'); |
179 | 179 | }); |
180 | 180 | // Migrate the instructions from the old table to the new column |
181 | 181 | $instructions = DB::select('SELECT * FROM `file_link_instructions`'); |
182 | - foreach ($instructions as $ins) { |
|
182 | + foreach($instructions as $ins) { |
|
183 | 183 | FileLinks::find($ins->link_id)->update([ |
184 | 184 | 'note' => $ins->instruction |
185 | 185 | ]); |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | // Add Notes column to the file links files table |
191 | 191 | private function addNotesColumnToFileLinkFiles() |
192 | 192 | { |
193 | - if (!Schema::hasColumn('file_link_files', 'note')) { |
|
194 | - Schema::table('file_link_files', function (Blueprint $table) { |
|
193 | + if(!Schema::hasColumn('file_link_files', 'note')) { |
|
194 | + Schema::table('file_link_files', function(Blueprint $table) { |
|
195 | 195 | $table->longText('note') |
196 | 196 | ->nullable() |
197 | 197 | ->after('upload'); |
198 | 198 | }); |
199 | 199 | // Migrate the existing notes to the new table |
200 | 200 | $notes = DB::select('SELECT * FROM `file_link_notes`'); |
201 | - foreach ($notes as $note) { |
|
201 | + foreach($notes as $note) { |
|
202 | 202 | FileLinkFiles::where('file_id', $note->file_id)->update([ |
203 | 203 | 'note' => $note->note |
204 | 204 | ]); |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | // Add the documentation column to the tech tips table |
210 | 210 | private function addDocumentationColumnToTechTips() |
211 | 211 | { |
212 | - if (!Schema::hasColumn('tech_tips', 'documentation')) { |
|
213 | - Schema::table('tech_tips', function (Blueprint $table) { |
|
212 | + if(!Schema::hasColumn('tech_tips', 'documentation')) { |
|
213 | + Schema::table('tech_tips', function(Blueprint $table) { |
|
214 | 214 | $table->boolean('documentation')->default(0)->nullable()->after('public'); |
215 | 215 | }); |
216 | 216 | |
217 | 217 | // Move all of the system files over to the tech tips table |
218 | 218 | $sysFiles = DB::select('SELECT * FROM `system_files`'); |
219 | - foreach ($sysFiles as $sysFile) { |
|
219 | + foreach($sysFiles as $sysFile) { |
|
220 | 220 | $newTip = TechTips::create([ |
221 | 221 | 'user_id' => $sysFile->user_id, |
222 | 222 | 'public' => 0, |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | // Remove the active column from the customers table |
253 | 253 | private function removeActiveFromCustomers() |
254 | 254 | { |
255 | - if (Schema::hasColumn('customers', 'active')) |
|
255 | + if(Schema::hasColumn('customers', 'active')) |
|
256 | 256 | { |
257 | 257 | // Migrate the existing disabled customers first |
258 | 258 | $deactivatedCustomers = Customers::where('active', 0)->get(); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | Customers::find($cust->cust_id)->delete(); |
262 | 262 | } |
263 | 263 | |
264 | - Schema::table('customers', function (Blueprint $table) { |
|
264 | + Schema::table('customers', function(Blueprint $table) { |
|
265 | 265 | $table->dropColumn('active'); |
266 | 266 | }); |
267 | 267 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | { |
273 | 273 | if(Schema::hasTable('user_role')) |
274 | 274 | { |
275 | - Schema::table('user_role', function (Blueprint $table) { |
|
275 | + Schema::table('user_role', function(Blueprint $table) { |
|
276 | 276 | $table->dropForeign(['user_id']); |
277 | 277 | $table->dropForeign(['role_id']); |
278 | 278 | }); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | if(Schema::hasTable('file_link_instructions')) |
288 | 288 | { |
289 | 289 | // Remove the foreign key to allow for dropping the table |
290 | - Schema::table('file_link_instructions', function (Blueprint $table) { |
|
290 | + Schema::table('file_link_instructions', function(Blueprint $table) { |
|
291 | 291 | $table->dropForeign(['link_id']); |
292 | 292 | }); |
293 | 293 | Schema::dropIfExists('file_link_instructions'); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | { |
300 | 300 | if(Schema::hasTable('file_link_notes')) |
301 | 301 | { |
302 | - Schema::table('file_link_notes', function (Blueprint $table) { |
|
302 | + Schema::table('file_link_notes', function(Blueprint $table) { |
|
303 | 303 | $table->dropForeign(['link_id']); |
304 | 304 | $table->dropForeign(['file_id']); |
305 | 305 | }); |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | // Remove the system files and system file types table |
311 | 311 | private function removeSystemFilesTables() |
312 | 312 | { |
313 | - if (Schema::hasTable('system_files')) { |
|
314 | - Schema::table('system_files', function (Blueprint $table) { |
|
313 | + if(Schema::hasTable('system_files')) { |
|
314 | + Schema::table('system_files', function(Blueprint $table) { |
|
315 | 315 | $table->dropForeign(['sys_id']); |
316 | 316 | $table->dropForeign(['type_id']); |
317 | 317 | $table->dropForeign(['file_id']); |
@@ -80,7 +80,8 @@ discard block |
||
80 | 80 | // Added the ability to set an expiration date for user passwords - will force them to change after this expires |
81 | 81 | private function addPasswordExpiresColumn() |
82 | 82 | { |
83 | - if (!Schema::hasColumn('users', 'password_expires')) { |
|
83 | + if (!Schema::hasColumn('users', 'password_expires')) |
|
84 | + { |
|
84 | 85 | Schema::table('users', function (Blueprint $table) { |
85 | 86 | $table->timestamp('password_expires') |
86 | 87 | ->nullable() |
@@ -150,7 +151,8 @@ discard block |
||
150 | 151 | // Added a 'hidden' attribute to system customer data types to allow passwords to not be viewed unless clicked or focus |
151 | 152 | private function addHiddenColumn() |
152 | 153 | { |
153 | - if (!Schema::hasColumn('system_data_field_types', 'hidden')) { |
|
154 | + if (!Schema::hasColumn('system_data_field_types', 'hidden')) |
|
155 | + { |
|
154 | 156 | Schema::table('system_cust_data_types', function (Blueprint $table) { |
155 | 157 | $table->boolean('hidden') |
156 | 158 | ->default(0) |
@@ -162,7 +164,8 @@ discard block |
||
162 | 164 | // Update the File links table - add cust_id and note column |
163 | 165 | private function addColumnsToFileLinksTable() |
164 | 166 | { |
165 | - if (!Schema::hasColumn('file_links', 'cust_id')) { |
|
167 | + if (!Schema::hasColumn('file_links', 'cust_id')) |
|
168 | + { |
|
166 | 169 | Schema::table('file_links', function (Blueprint $table) { |
167 | 170 | $table->integer('cust_id') |
168 | 171 | ->unsigned() |
@@ -171,7 +174,8 @@ discard block |
||
171 | 174 | $table->foreign('cust_id')->references('cust_id')->on('customers')->onUpdate('cascade')->onDelete('cascade'); |
172 | 175 | }); |
173 | 176 | } |
174 | - if (!Schema::hasColumn('file_links', 'note')) { |
|
177 | + if (!Schema::hasColumn('file_links', 'note')) |
|
178 | + { |
|
175 | 179 | Schema::table('file_links', function (Blueprint $table) { |
176 | 180 | $table->longText('note') |
177 | 181 | ->nullable() |
@@ -179,7 +183,8 @@ discard block |
||
179 | 183 | }); |
180 | 184 | // Migrate the instructions from the old table to the new column |
181 | 185 | $instructions = DB::select('SELECT * FROM `file_link_instructions`'); |
182 | - foreach ($instructions as $ins) { |
|
186 | + foreach ($instructions as $ins) |
|
187 | + { |
|
183 | 188 | FileLinks::find($ins->link_id)->update([ |
184 | 189 | 'note' => $ins->instruction |
185 | 190 | ]); |
@@ -190,7 +195,8 @@ discard block |
||
190 | 195 | // Add Notes column to the file links files table |
191 | 196 | private function addNotesColumnToFileLinkFiles() |
192 | 197 | { |
193 | - if (!Schema::hasColumn('file_link_files', 'note')) { |
|
198 | + if (!Schema::hasColumn('file_link_files', 'note')) |
|
199 | + { |
|
194 | 200 | Schema::table('file_link_files', function (Blueprint $table) { |
195 | 201 | $table->longText('note') |
196 | 202 | ->nullable() |
@@ -198,7 +204,8 @@ discard block |
||
198 | 204 | }); |
199 | 205 | // Migrate the existing notes to the new table |
200 | 206 | $notes = DB::select('SELECT * FROM `file_link_notes`'); |
201 | - foreach ($notes as $note) { |
|
207 | + foreach ($notes as $note) |
|
208 | + { |
|
202 | 209 | FileLinkFiles::where('file_id', $note->file_id)->update([ |
203 | 210 | 'note' => $note->note |
204 | 211 | ]); |
@@ -209,14 +216,16 @@ discard block |
||
209 | 216 | // Add the documentation column to the tech tips table |
210 | 217 | private function addDocumentationColumnToTechTips() |
211 | 218 | { |
212 | - if (!Schema::hasColumn('tech_tips', 'documentation')) { |
|
219 | + if (!Schema::hasColumn('tech_tips', 'documentation')) |
|
220 | + { |
|
213 | 221 | Schema::table('tech_tips', function (Blueprint $table) { |
214 | 222 | $table->boolean('documentation')->default(0)->nullable()->after('public'); |
215 | 223 | }); |
216 | 224 | |
217 | 225 | // Move all of the system files over to the tech tips table |
218 | 226 | $sysFiles = DB::select('SELECT * FROM `system_files`'); |
219 | - foreach ($sysFiles as $sysFile) { |
|
227 | + foreach ($sysFiles as $sysFile) |
|
228 | + { |
|
220 | 229 | $newTip = TechTips::create([ |
221 | 230 | 'user_id' => $sysFile->user_id, |
222 | 231 | 'public' => 0, |
@@ -310,7 +319,8 @@ discard block |
||
310 | 319 | // Remove the system files and system file types table |
311 | 320 | private function removeSystemFilesTables() |
312 | 321 | { |
313 | - if (Schema::hasTable('system_files')) { |
|
322 | + if (Schema::hasTable('system_files')) |
|
323 | + { |
|
314 | 324 | Schema::table('system_files', function (Blueprint $table) { |
315 | 325 | $table->dropForeign(['sys_id']); |
316 | 326 | $table->dropForeign(['type_id']); |
@@ -347,8 +357,7 @@ discard block |
||
347 | 357 | { |
348 | 358 | if(!Schema::hasColumn('customer_systems', 'deleted_at')) |
349 | 359 | { |
350 | - Schema::table('customer_systems', function(Blueprint $table) |
|
351 | - { |
|
360 | + Schema::table('customer_systems', function(Blueprint $table) { |
|
352 | 361 | $table->softDeletes()->after('sys_id'); |
353 | 362 | }); |
354 | 363 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use App\SystemDataFields; |
6 | 6 | |
7 | -$factory->define(SystemDataFields::class, function () { |
|
7 | +$factory->define(SystemDataFields::class, function() { |
|
8 | 8 | return [ |
9 | 9 | // |
10 | 10 | 'sys_id' => factory(App\SystemTypes::class)->create()->sys_id, |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use App\CustomerSystems; |
6 | 6 | |
7 | -$factory->define(CustomerSystems::class, function () { |
|
7 | +$factory->define(CustomerSystems::class, function() { |
|
8 | 8 | return [ |
9 | 9 | // |
10 | 10 | 'cust_id' => factory(App\Customers::class)->create()->cust_id, |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use App\SystemTypes; |
6 | 6 | use Faker\Generator as Faker; |
7 | 7 | |
8 | -$factory->define(SystemTypes::class, function (Faker $faker) { |
|
8 | +$factory->define(SystemTypes::class, function(Faker $faker) { |
|
9 | 9 | return [ |
10 | 10 | // |
11 | 11 | 'cat_id' => factory(App\SystemCategories::class)->create()->cat_id, |