Test Failed
Push — dev5 ( 12da53...ea9e9d )
by Ron
07:49
created
app/Policies/GatePolicy.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
     //  Determine if a user can see the Administration Nav Link
37 37
     public function seeAdminLink(User $user)
38 38
     {
39
-        if ($this->isInstaller($user))
39
+        if($this->isInstaller($user))
40 40
         {
41 41
             return true;
42 42
         }
43 43
 
44 44
         $data = UserRolePermissions::with('UserRolePermissionTypes')
45
-            ->whereHas('UserRolePermissionTypes', function ($query) {
45
+            ->whereHas('UserRolePermissionTypes', function($query) {
46 46
                 $query->where('description', 'Manage Users')
47 47
                     ->orWhere('description', 'Manage User Roles')
48 48
                     ->orWhere('description', 'Manage Customers')
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             ->get();
54 54
 
55 55
         $allow = $data->isEmpty() ? 'false' : 'true';
56
-        \Log::debug('User ' . $user->full_name . ' is trying to access admin link.  Result - ' . $allow);
56
+        \Log::debug('User '.$user->full_name.' is trying to access admin link.  Result - '.$allow);
57 57
 
58 58
         return  $data->isEmpty() ? false : true;
59 59
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         }
69 69
 
70 70
         $data = UserRolePermissions::with('UserRolePermissionTypes')
71
-            ->whereHas('UserRolePermissionTypes', function ($query) use ($task) {
71
+            ->whereHas('UserRolePermissionTypes', function($query) use ($task) {
72 72
                 $query->where('description', $task);
73 73
             })
74 74
             ->where('role_id', $user->role_id)
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             ->get();
77 77
 
78 78
         $allow = $data->isEmpty() ? 'false' : 'true';
79
-        \Log::debug('User '.$user->full_name.' is trying to access '.$task.'.  Result - ' . $allow);
79
+        \Log::debug('User '.$user->full_name.' is trying to access '.$task.'.  Result - '.$allow);
80 80
 
81 81
         return  $data->isEmpty() ? false : true;
82 82
     }
Please login to merge, or discard this patch.
app/Http/Controllers/AccountController.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
         //  Validate the hash token
136 136
         $user = UserInitialize::where('token', $hash)->get();
137 137
 
138
-        if ($user->isEmpty()) {
139
-            Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
140
-            Log::warning('Visitor at IP Address ' . \Request::ip() . ' tried to access invalid initialize hash - ' . $hash);
138
+        if($user->isEmpty()) {
139
+            Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
140
+            Log::warning('Visitor at IP Address '.\Request::ip().' tried to access invalid initialize hash - '.$hash);
141 141
             return abort(404);
142 142
         }
143 143
 
144
-        Log::debug('Route ' . Route::currentRouteName() . ' visited.');
145
-        Log::debug('Link Hash -' . $hash);
144
+        Log::debug('Route '.Route::currentRouteName().' visited.');
145
+        Log::debug('Link Hash -'.$hash);
146 146
         return view('account.initializeUser', ['hash' => $hash]);
147 147
     }
148 148
 
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
     {
152 152
         //  Verify that the link matches the assigned email address
153 153
         $valid = UserInitialize::where('token', $hash)->first();
154
-        if (empty($valid)) {
155
-            Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
156
-            Log::warning('Visitor at IP Address ' . \Request::ip() . ' tried to submit an invalid User Initialization link - ' . $hash);
154
+        if(empty($valid)) {
155
+            Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
156
+            Log::warning('Visitor at IP Address '.\Request::ip().' tried to submit an invalid User Initialization link - '.$hash);
157 157
             return abort(404);
158 158
         }
159 159
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
         Auth::loginUsingID($userData->user_id);
187 187
 
188 188
         //  Redirect the user to the dashboard
189
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
190
-        Log::debug('Initialize Data - ' . $request->toArray());
189
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
190
+        Log::debug('Initialize Data - '.$request->toArray());
191 191
         Log::notice('User has setup account', ['user_id' => $userData->user_id]);
192 192
         return redirect(route('dashboard'));
193 193
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -135,7 +135,8 @@  discard block
 block discarded – undo
135 135
         //  Validate the hash token
136 136
         $user = UserInitialize::where('token', $hash)->get();
137 137
 
138
-        if ($user->isEmpty()) {
138
+        if ($user->isEmpty())
139
+        {
139 140
             Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
140 141
             Log::warning('Visitor at IP Address ' . \Request::ip() . ' tried to access invalid initialize hash - ' . $hash);
141 142
             return abort(404);
@@ -151,7 +152,8 @@  discard block
 block discarded – undo
151 152
     {
152 153
         //  Verify that the link matches the assigned email address
153 154
         $valid = UserInitialize::where('token', $hash)->first();
154
-        if (empty($valid)) {
155
+        if (empty($valid))
156
+        {
155 157
             Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
156 158
             Log::warning('Visitor at IP Address ' . \Request::ip() . ' tried to submit an invalid User Initialization link - ' . $hash);
157 159
             return abort(404);
Please login to merge, or discard this patch.
database/migrations/2018_05_31_001549_create_tech_tip_comments_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
             $table->longText('comment');
21 21
             $table->timestamps();
22 22
             $table->foreign('tip_id')->references('tip_id')->on('tech_tips')->onUpdate('cascade')->onDelete('cascade');
23
-            $table->foreign('user_id')->references('user_id')->on('users')->onUpdate('cascade');  //  TODO - add this key in v5 updates if it does not exist
23
+            $table->foreign('user_id')->references('user_id')->on('users')->onUpdate('cascade'); //  TODO - add this key in v5 updates if it does not exist
24 24
         });
25 25
     }
26 26
 
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/UserController.php 2 patches
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -181,12 +181,18 @@  discard block
 block discarded – undo
181 181
 
182 182
         //  Good to go - update user password
183 183
         $roleArr = [];
184
-        foreach ($roles as $role) {
185
-            if ($role->role_id == 1 && Auth::user()->role_id != 1) {
184
+        foreach ($roles as $role)
185
+        {
186
+            if ($role->role_id == 1 && Auth::user()->role_id != 1)
187
+            {
186 188
                 continue;
187
-            } else if ($role->role_id == 2 && Auth::user()->role_id > 1) {
189
+            }
190
+            else if ($role->role_id == 2 && Auth::user()->role_id > 1)
191
+            {
188 192
                 continue;
189
-            } else {
193
+            }
194
+            else
195
+            {
190 196
                 // $roleArr[$role->role_id] = $role->name;
191 197
                 $roleArr[] = [
192 198
                     'value' => $role->role_id,
@@ -275,17 +281,20 @@  discard block
 block discarded – undo
275 281
         $user = User::find($request->user_id);
276 282
 
277 283
         //  Verify this is a valid user ID
278
-        if (!$user) {
284
+        if (!$user)
285
+        {
279 286
             $success = false;
280 287
             $reason  = 'Cannot find user with this ID';
281 288
         }
282 289
         //  Make sure that the user is not trying to deactivate someone with more permissions
283
-        else if ($user->role_id < Auth::user()->role_id) {
290
+        else if ($user->role_id < Auth::user()->role_id)
291
+        {
284 292
             $success = false;
285 293
             $reason  = 'You cannot change password for a user with higher permissions that you.  If this user has locked themselves out, have then use the reset link on the login page.';
286 294
         }
287 295
         //  Good to go - update user password
288
-        else {
296
+        else
297
+        {
289 298
             //  Update the user data
290 299
             $user->update(
291 300
             [
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public function __construct()
31 31
     {
32 32
         $this->middleware('auth')->except('initializeUser', 'submitInitializeUser');
33
-        $this->middleware(function ($request, $next) {
33
+        $this->middleware(function($request, $next) {
34 34
             $this->authorize('hasAccess', 'Manage Users');
35 35
             return $next($request);
36 36
         });
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
     //  Show the list of current users to edit
40 40
     public function index()
41 41
     {
42
-        $userList = new UserCollection(User::with(['UserLogins' => function ($query) {
42
+        $userList = new UserCollection(User::with(['UserLogins' => function($query) {
43 43
             $query->latest()->limit(1);
44 44
         }])->get()
45 45
             /** @scrutinizer ignore-call */
46 46
             ->makeVisible('user_id'));
47
-        $route    = 'admin.user.edit';
47
+        $route = 'admin.user.edit';
48 48
 
49 49
         return view('admin.userIndex', [
50 50
             'userList' => $userList,
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         //  Validate the new user form
108 108
         $request->validate([
109
-            'role'       => 'required|numeric',  //  TODO - add validation rule - is in user roles table
109
+            'role'       => 'required|numeric', //  TODO - add validation rule - is in user roles table
110 110
             'username'   => 'required|unique:users|regex:/^[a-zA-Z0-9_]*$/',
111 111
             'first_name' => 'required',
112 112
             'last_name'  => 'required',
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     //  List all inactive users
148 148
     public function show($type)
149 149
     {
150
-        $route    = '';
150
+        $route = '';
151 151
 
152 152
         if($type !== 'inactive')
153 153
         {
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
         $user  = new UserResource(User::findOrFail($id));
172 172
 
173 173
         //  Make sure that the user is not trying to deactivate someone with more permissions
174
-        if ($user->role_id < Auth::user()->role_id)
174
+        if($user->role_id < Auth::user()->role_id)
175 175
         {
176 176
             return abort(403);
177 177
         }
178 178
 
179 179
         //  Good to go - update user password
180 180
         $roleArr = [];
181
-        foreach ($roles as $role) {
182
-            if ($role->role_id == 1 && Auth::user()->role_id != 1) {
181
+        foreach($roles as $role) {
182
+            if($role->role_id == 1 && Auth::user()->role_id != 1) {
183 183
                 continue;
184
-            } else if ($role->role_id == 2 && Auth::user()->role_id > 1) {
184
+            } else if($role->role_id == 2 && Auth::user()->role_id > 1) {
185 185
                 continue;
186 186
             } else {
187 187
                 // $roleArr[$role->role_id] = $role->name;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             }
193 193
         }
194 194
 
195
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
195
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
196 196
         return view('admin.userEdit', [
197 197
             'roles' => $roleArr,
198 198
             'user'  => $user->
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         //  Update the user data
232 232
         $user = User::findOrFail($id);
233 233
 
234
-        if ($user->role_id < Auth::user()->role_id)
234
+        if($user->role_id < Auth::user()->role_id)
235 235
         {
236 236
             return abort(403);
237 237
         }
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
         $user = User::find($request->user_id);
275 275
 
276 276
         //  Verify this is a valid user ID
277
-        if (!$user) {
277
+        if(!$user) {
278 278
             $success = false;
279 279
             $reason  = 'Cannot find user with this ID';
280 280
         }
281 281
         //  Make sure that the user is not trying to deactivate someone with more permissions
282
-        else if ($user->role_id < Auth::user()->role_id) {
282
+        else if($user->role_id < Auth::user()->role_id) {
283 283
             $success = false;
284 284
             $reason  = 'You cannot change password for a user with higher permissions that you.  If this user has locked themselves out, have then use the reset link on the login page.';
285 285
         }
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
                 'password_expires' => $nextChange
293 293
             ]);
294 294
             $success = true;
295
-            $reason  = 'Password for ' . $user->full_name . ' successfully reset.';
295
+            $reason  = 'Password for '.$user->full_name.' successfully reset.';
296 296
         }
297 297
 
298
-        Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id);
299
-        Log::notice('User ID-' . $request->user_id . ' password chagned by ' . Auth::user()->user_id, [
298
+        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
299
+        Log::notice('User ID-'.$request->user_id.' password chagned by '.Auth::user()->user_id, [
300 300
             'success' => $success,
301 301
             'reason'  => $reason,
302 302
         ]);
Please login to merge, or discard this patch.
app/Http/Controllers/Installer/CategoriesController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,8 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
app/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
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',
Please login to merge, or discard this patch.
database/factories/UserRolePermissionTypesFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
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),
Please login to merge, or discard this patch.
database/factories/UserRolePermissionsFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
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,
Please login to merge, or discard this patch.
app/Http/Controllers/Installer/SystemsController.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -131,8 +131,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.