@@ -17,7 +17,8 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function handle($request, Closure $next, $guard = null) |
| 19 | 19 | { |
| 20 | - if(Auth::guard($guard)->check()) { |
|
| 20 | + if(Auth::guard($guard)->check()) |
|
| 21 | + { |
|
| 21 | 22 | return redirect('/dashboard'); |
| 22 | 23 | } |
| 23 | 24 | |
@@ -47,8 +47,7 @@ discard block |
||
| 47 | 47 | $searchResults = new CustomersCollection( |
| 48 | 48 | Customers::orderBy($request->sortField, $request->sortType) |
| 49 | 49 | // Search the name, dba name, and cust id columns |
| 50 | - ->where(function($query) use ($request) |
|
| 51 | - { |
|
| 50 | + ->where(function($query) use ($request) { |
|
| 52 | 51 | $query->where('name', 'like', '%' . $request->name . '%') |
| 53 | 52 | ->orWhere('cust_id', 'like', '%' . $request->name . '%') |
| 54 | 53 | ->orWhere('dba_name', 'like', '%' . $request->name . '%'); |
@@ -58,10 +57,8 @@ discard block |
||
| 58 | 57 | // Include the customers systems |
| 59 | 58 | ->with('CustomerSystems.SystemTypes') |
| 60 | 59 | // If the system field is present - search for system type |
| 61 | - ->when($request->system, function($query) use ($request) |
|
| 62 | - { |
|
| 63 | - $query->whereHas('CustomerSystems.SystemTypes', function($query) use ($request) |
|
| 64 | - { |
|
| 60 | + ->when($request->system, function($query) use ($request) { |
|
| 61 | + $query->whereHas('CustomerSystems.SystemTypes', function($query) use ($request) { |
|
| 65 | 62 | $query->where('sys_id', $request->system); |
| 66 | 63 | }); |
| 67 | 64 | }) |
@@ -12,8 +12,7 @@ |
||
| 12 | 12 | public function run() |
| 13 | 13 | { |
| 14 | 14 | // Create the test users - note, none are installers - permissions are assigned randomly |
| 15 | - factory(App\User::class, 15)->create()->each(function($user) |
|
| 16 | - { |
|
| 15 | + factory(App\User::class, 15)->create()->each(function($user) { |
|
| 17 | 16 | $user->UserPermissions()->save(factory(App\UserPermissions::class)->create(['user_id' => $user->user_id])); |
| 18 | 17 | }); |
| 19 | 18 | } |
@@ -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']); |