Passed
Push — dev5 ( e66ef8...5a922b )
by Ron
05:53
created
app/Http/Middleware/RedirectIfAuthenticated.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Http/Controllers/Customers/CustomerController.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,8 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                     })
Please login to merge, or discard this patch.
database/seeds/UserTableSeeder.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
database/migrations/2019_10_19_175205_updates_for_version_5_0.php 1 patch
Braces   +38 added lines, -19 removed lines patch added patch discarded remove patch
@@ -85,7 +85,8 @@  discard block
 block discarded – undo
85 85
     //  Added the ability to set an expiration date for user passwords - will force them to change after this expires
86 86
     private function addPasswordExpiresColumn()
87 87
     {
88
-        if (!Schema::hasColumn('users', 'password_expires')) {
88
+        if (!Schema::hasColumn('users', 'password_expires'))
89
+        {
89 90
             Schema::table('users', function (Blueprint $table) {
90 91
                 $table->timestamp('password_expires')
91 92
                     ->nullable()
@@ -97,18 +98,22 @@  discard block
 block discarded – undo
97 98
     //  Add the is installer column to the users table
98 99
     private function addIsInstallerToUsers()
99 100
     {
100
-        if (!Schema::hasColumn('users', 'is_installer')) {
101
+        if (!Schema::hasColumn('users', 'is_installer'))
102
+        {
101 103
             Schema::table('users', function (Blueprint $table) {
102 104
                 $table->boolean('is_installer')->default(0)->after('active');
103 105
             });
104 106
 
105 107
             //  TODO - Clean this up, it does not work
106 108
             //  Migrate user roles from the 'user roles' table to the new 'user permissions' table
107
-            if (Schema::hasTable('user_permissions') && (UserPermissions::all()->isEmpty())) {
109
+            if (Schema::hasTable('user_permissions') && (UserPermissions::all()->isEmpty()))
110
+            {
108 111
                 $userRoles = DB::select('SELECT * FROM `user_role` LEFT JOIN `roles` ON `user_role`.`role_id` = `roles`.`role_id`');
109 112
 
110
-                foreach ($userRoles as $user) {
111
-                    if ($user->name === 'Installer') {
113
+                foreach ($userRoles as $user)
114
+                {
115
+                    if ($user->name === 'Installer')
116
+                    {
112 117
                         User::find($user->user_id)->update(
113 118
                             [
114 119
                                 'is_installer' => 1
@@ -129,7 +134,9 @@  discard block
 block discarded – undo
129 134
                                 'modify_category'     => 1
130 135
                             ]
131 136
                         );
132
-                    } else if ($user->name === 'Admin') {
137
+                    }
138
+                    else if ($user->name === 'Admin')
139
+                    {
133 140
                         UserPermissions::create(
134 141
                             [
135 142
                                 'user_id'             => $user->user_id,
@@ -145,7 +152,9 @@  discard block
 block discarded – undo
145 152
                                 'modify_category'     => 1
146 153
                             ]
147 154
                         );
148
-                    } else if ($user->name === 'Report') {
155
+                    }
156
+                    else if ($user->name === 'Report')
157
+                    {
149 158
                         UserPermissions::create(
150 159
                             [
151 160
                                 'user_id'             => $user->user_id,
@@ -161,7 +170,9 @@  discard block
 block discarded – undo
161 170
                                 'modify_category'     => 0
162 171
                             ]
163 172
                         );
164
-                    } else {
173
+                    }
174
+                    else
175
+                    {
165 176
                         UserPermissions::create(
166 177
                             [
167 178
                                 'user_id'             => $user->user_id,
@@ -186,7 +197,8 @@  discard block
 block discarded – undo
186 197
     //  Added a 'hidden' attribute to system customer data types to allow passwords to not be viewed unless clicked or focus
187 198
     private function addHiddenColumn()
188 199
     {
189
-        if (!Schema::hasColumn('system_data_field_types', 'hidden')) {
200
+        if (!Schema::hasColumn('system_data_field_types', 'hidden'))
201
+        {
190 202
             Schema::table('system_cust_data_types', function (Blueprint $table) {
191 203
                 $table->boolean('hidden')
192 204
                     ->default(0)
@@ -198,7 +210,8 @@  discard block
 block discarded – undo
198 210
     //  Update the File links table - add cust_id and note column
199 211
     private function addColumnsToFileLinksTable()
200 212
     {
201
-        if (!Schema::hasColumn('file_links', 'cust_id')) {
213
+        if (!Schema::hasColumn('file_links', 'cust_id'))
214
+        {
202 215
             Schema::table('file_links', function (Blueprint $table) {
203 216
                 $table->integer('cust_id')
204 217
                     ->unsigned()
@@ -207,7 +220,8 @@  discard block
 block discarded – undo
207 220
                 $table->foreign('cust_id')->references('cust_id')->on('customers')->onUpdate('cascade')->onDelete('cascade');
208 221
             });
209 222
         }
210
-        if (!Schema::hasColumn('file_links', 'note')) {
223
+        if (!Schema::hasColumn('file_links', 'note'))
224
+        {
211 225
             Schema::table('file_links', function (Blueprint $table) {
212 226
                 $table->longText('note')
213 227
                     ->nullable()
@@ -215,7 +229,8 @@  discard block
 block discarded – undo
215 229
             });
216 230
             //  Migrate the instructions from the old table to the new column
217 231
             $instructions = DB::select('SELECT * FROM `file_link_instructions`');
218
-            foreach ($instructions as $ins) {
232
+            foreach ($instructions as $ins)
233
+            {
219 234
                 FileLinks::find($ins->link_id)->update([
220 235
                     'note' => $ins->instruction
221 236
                 ]);
@@ -226,7 +241,8 @@  discard block
 block discarded – undo
226 241
     //  Add Notes column to the file links files table
227 242
     private function addNotesColumnToFileLinkFiles()
228 243
     {
229
-        if (!Schema::hasColumn('file_link_files', 'note')) {
244
+        if (!Schema::hasColumn('file_link_files', 'note'))
245
+        {
230 246
             Schema::table('file_link_files', function (Blueprint $table) {
231 247
                 $table->longText('note')
232 248
                     ->nullable()
@@ -234,7 +250,8 @@  discard block
 block discarded – undo
234 250
             });
235 251
             //  Migrate the existing notes to the new table
236 252
             $notes = DB::select('SELECT * FROM `file_link_notes`');
237
-            foreach ($notes as $note) {
253
+            foreach ($notes as $note)
254
+            {
238 255
                 FileLinkFiles::where('file_id', $note->file_id)->update([
239 256
                     'note' => $note->note
240 257
                 ]);
@@ -245,14 +262,16 @@  discard block
 block discarded – undo
245 262
     //  Add the documentation column to the tech tips table
246 263
     private function addDocumentationColumnToTechTips()
247 264
     {
248
-        if (!Schema::hasColumn('tech_tips', 'documentation')) {
265
+        if (!Schema::hasColumn('tech_tips', 'documentation'))
266
+        {
249 267
             Schema::table('tech_tips', function (Blueprint $table) {
250 268
                 $table->boolean('documentation')->default(0)->nullable()->after('public');
251 269
             });
252 270
 
253 271
             //  Move all of the system files over to the tech tips table
254 272
             $sysFiles = DB::select('SELECT * FROM `system_files`');
255
-            foreach ($sysFiles as $sysFile) {
273
+            foreach ($sysFiles as $sysFile)
274
+            {
256 275
                 $newTip = TechTips::create([
257 276
                     'user_id'       => $sysFile->user_id,
258 277
                     'public'        => 0,
@@ -347,7 +366,8 @@  discard block
 block discarded – undo
347 366
     //  Remove the system files and system file types table
348 367
     private function removeSystemFilesTables()
349 368
     {
350
-        if (Schema::hasTable('system_files')) {
369
+        if (Schema::hasTable('system_files'))
370
+        {
351 371
             Schema::table('system_files', function (Blueprint $table) {
352 372
                 $table->dropForeign(['sys_id']);
353 373
                 $table->dropForeign(['type_id']);
@@ -384,8 +404,7 @@  discard block
 block discarded – undo
384 404
     {
385 405
         if(!Schema::hasColumn('customer_systems', 'deleted_at'))
386 406
         {
387
-            Schema::table('customer_systems', function(Blueprint $table)
388
-            {
407
+            Schema::table('customer_systems', function(Blueprint $table) {
389 408
                 $table->softDeletes()->after('sys_id');
390 409
             });
391 410
         }
Please login to merge, or discard this patch.