Passed
Push — master ( 17c8d8...65308f )
by Jonathan
09:04
created
app/Models/User.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         // Check if user is admin or if he has at least a role on the domain
110 110
         // or on descendants domains if withDescendants option is on
111 111
         $builder->where('domain_id', $domain->id)
112
-            ->orWhereIn($this->getKeyName(), function ($query) use ($domain, $withDescendants) {
112
+            ->orWhereIn($this->getKeyName(), function($query) use ($domain, $withDescendants) {
113 113
                 $privilegesTable = env('UCCELLO_TABLE_PREFIX', 'uccello_').'privileges';
114 114
 
115 115
                 $query->select('user_id')
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
         $i = 0;
202 202
         foreach ($words as $w) {
203
-            $initials .= $w[0];
203
+            $initials .= $w[ 0 ];
204 204
             $i++;
205 205
 
206 206
             if ($i === 3) { // Maximum: 3 letters
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         $image = 'vendor/uccello/uccello/images/user-no-image.png';
222 222
 
223 223
         if ($this->avatarType === 'gravatar') {
224
-            $image = 'https://www.gravatar.com/avatar/' . md5($this->email) . '?d=mm';
224
+            $image = 'https://www.gravatar.com/avatar/'.md5($this->email).'?d=mm';
225 225
 
226 226
         } elseif ($this->avatarType === 'image' && !empty($this->avatar->path)) {
227 227
             $image = $this->avatar->path;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      * @param mixed $defaultValue
248 248
      * @return \stdClass|null;
249 249
      */
250
-    public function getSettings($key, $defaultValue=null) {
250
+    public function getSettings($key, $defaultValue = null) {
251 251
         return $this->userSettings->data->{$key} ?? $defaultValue;
252 252
     }
253 253
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
         $hasRole = false;
368 368
 
369
-        $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function () use($domain) {
369
+        $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function() use($domain) {
370 370
             return $domain->findDescendants()->get();
371 371
         });
372 372
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     {
393 393
         $keyName = 'user_'.$this->id.'_'.$domain->slug.'_'.$module->name.'_capabilities';
394 394
 
395
-        return Cache::remember($keyName, 600, function () use($domain, $module) {
395
+        return Cache::remember($keyName, 600, function() use($domain, $module) {
396 396
             $capabilities = collect();
397 397
 
398 398
             // Get the domain and all its parents
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
         $keyName = 'user_'.$this->id.'_'.$domain->slug.'_can_access_to_settings_panel';
448 448
 
449
-        return Cache::remember($keyName, 600, function () use($domain) {
449
+        return Cache::remember($keyName, 600, function() use($domain) {
450 450
 
451 451
             $hasCapability = false;
452 452
 
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
     {
599 599
         // Use cache
600 600
         $allowedGroups = Cache::rememberForever(
601
-            'allowed_groups_for_' . ($this->is_admin ? 'admin' : $this->getKey()),
602
-            function () {
601
+            'allowed_groups_for_'.($this->is_admin ? 'admin' : $this->getKey()),
602
+            function() {
603 603
                 return $this->getAllowedGroupUuidsProcess();
604 604
             }
605 605
         );
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
     {
612 612
         // Use cache
613 613
         $allowedGroupsAndUsers = Cache::rememberForever(
614
-            'allowed_group_users_for_' . ($addUsers ? 'u_' : '') . ($this->is_admin ? 'admin' : $this->getKey()),
615
-            function () use ($addUsers) {
614
+            'allowed_group_users_for_'.($addUsers ? 'u_' : '').($this->is_admin ? 'admin' : $this->getKey()),
615
+            function() use ($addUsers) {
616 616
                 return $this->getAllowedGroupsAndUsersProcess($addUsers);
617 617
             }
618 618
         );
@@ -622,16 +622,16 @@  discard block
 block discarded – undo
622 622
 
623 623
     protected function getAllowedGroupUuidsProcess()
624 624
     {
625
-        $allowedUserUuids = collect([$this->uuid]);
625
+        $allowedUserUuids = collect([ $this->uuid ]);
626 626
 
627 627
         if ($this->is_admin) {
628 628
             $groups = Group::all();
629 629
         } else {
630
-            $groups = [];
631
-            $users = [];
630
+            $groups = [ ];
631
+            $users = [ ];
632 632
 
633 633
             foreach ($this->groups as $group) {
634
-                $groups[$group->uuid] = $group;
634
+                $groups[ $group->uuid ] = $group;
635 635
             };
636 636
 
637 637
             $this->addRecursiveChildrenGroups($groups, $users, $groups, false);
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
         }
641 641
 
642 642
         foreach ($groups as $uuid => $group) {
643
-            $allowedUserUuids[] = $uuid;
643
+            $allowedUserUuids[ ] = $uuid;
644 644
         }
645 645
 
646 646
         return $allowedUserUuids;
@@ -649,19 +649,19 @@  discard block
 block discarded – undo
649 649
     protected function addRecursiveChildrenGroups(&$groups, &$users, $searchGroups, $addUsers = false)
650 650
     {
651 651
         foreach ($searchGroups as $uuid => $searchGroup) {
652
-            $searchChildrenGroups = [];
652
+            $searchChildrenGroups = [ ];
653 653
 
654 654
             foreach ($searchGroup->childrenGroups as $childrenGroup) {
655
-                if (empty($groups[$childrenGroup->uuid])) {
656
-                    $groups[$childrenGroup->uuid] = $childrenGroup;
657
-                    $searchChildrenGroups[$childrenGroup->uuid] = $childrenGroup;
655
+                if (empty($groups[ $childrenGroup->uuid ])) {
656
+                    $groups[ $childrenGroup->uuid ] = $childrenGroup;
657
+                    $searchChildrenGroups[ $childrenGroup->uuid ] = $childrenGroup;
658 658
                 }
659 659
 
660
-                if($addUsers)
660
+                if ($addUsers)
661 661
                 {
662 662
                     foreach ($childrenGroup->users as $user) {
663
-                        if (empty($users[$user->uuid])) {
664
-                            $users[$user->uuid] = $user;
663
+                        if (empty($users[ $user->uuid ])) {
664
+                            $users[ $user->uuid ] = $user;
665 665
                         }
666 666
                     }
667 667
                 }
@@ -673,10 +673,10 @@  discard block
 block discarded – undo
673 673
 
674 674
     protected function getAllowedGroupsAndUsersProcess($addUsers = true)
675 675
     {
676
-        $allowedUserUuids = collect([[
676
+        $allowedUserUuids = collect([ [
677 677
             'uuid' => $this->uuid,
678 678
             'recordLabel' => uctrans('me', $this->module)
679
-        ]]);
679
+        ] ]);
680 680
 
681 681
         // if ($this->is_admin) {
682 682
             $groups = Group::orderBy('name')->get();
@@ -705,15 +705,15 @@  discard block
 block discarded – undo
705 705
         // }
706 706
 
707 707
         foreach ($groups as $uuid => $group) {
708
-            $allowedUserUuids[] = [
708
+            $allowedUserUuids[ ] = [
709 709
                 'uuid' => $group->uuid,
710 710
                 'recordLabel' => $group->recordLabel
711 711
             ];
712 712
         }
713 713
 
714 714
         foreach ($users as $uuid => $user) {
715
-            if($user->getKey() != $this->getKey()) {
716
-                $allowedUserUuids[] = [
715
+            if ($user->getKey() != $this->getKey()) {
716
+                $allowedUserUuids[ ] = [
717 717
                     'uuid' => $user->uuid,
718 718
                     'recordLabel' => $user->recordLabel
719 719
                 ];
Please login to merge, or discard this patch.
app/Support/Scopes/AssignedUser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             $builder->whereIn($model->getTable().'.assigned_user_id', $user->getAllowedGroupUuids());
28 28
 
29 29
             // Records assigned to an user with roles subordonate to the roles of the user
30
-            $builder->orWhereIn($model->getTable().'.assigned_user_id', function ($query) use ($user) {
30
+            $builder->orWhereIn($model->getTable().'.assigned_user_id', function($query) use ($user) {
31 31
                 $entityTable = with(new Entity)->getTable();
32 32
                 $privilegesTable = env('UCCELLO_TABLE_PREFIX', 'uccello_').'privileges';
33 33
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
                 $query->select($entityTable.'.id')
38 38
                     ->from($entityTable)
39
-                    ->join($privilegesTable, function ($join) use($entityTable, $privilegesTable, $subordonateRolesIds) {
39
+                    ->join($privilegesTable, function($join) use($entityTable, $privilegesTable, $subordonateRolesIds) {
40 40
                         $join->on("$privilegesTable.user_id", '=', $entityTable.'.record_id')
41 41
                         ->whereIn("$privilegesTable.role_id", $subordonateRolesIds);
42 42
                     })
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
             // Records created by the user
47 47
             if (!empty($model->module)) {
48
-                $builder->orWhereIn($model->getTable().'.'.$model->getKeyName(), function ($query) use($model) {
48
+                $builder->orWhereIn($model->getTable().'.'.$model->getKeyName(), function($query) use($model) {
49 49
                     $query->select('record_id')
50 50
                     ->from(with(new Entity)->getTable())
51 51
                     ->where('module_id', $model->module->id ?? null)
Please login to merge, or discard this patch.
app/Http/Controllers/Core/ListController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
         // Get filters
52 52
         $filters = Filter::where('module_id', $module->id)  // Module
53 53
             ->where('type', 'list')                         // Type (list)
54
-            ->where(function ($query) use($domain) {        // Domain
54
+            ->where(function($query) use($domain) {        // Domain
55 55
                 $query->whereNull('domain_id')
56 56
                     ->orWhere('domain_id', $domain->getKey());
57 57
             })
58
-            ->where(function ($query) {                     // User
58
+            ->where(function($query) {                     // User
59 59
                 $query->where('is_public', true)
60
-                    ->orWhere(function ($query) {
60
+                    ->orWhere(function($query) {
61 61
                         $query->where('is_public', false)
62 62
                             ->where('user_id', '=', auth()->id());
63 63
                     })
64
-                    ->orWhere(function ($query) {
64
+                    ->orWhere(function($query) {
65 65
                         $query->where('is_public', false)
66 66
                             ->whereNull('user_id');
67 67
                     });
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             ->get();
71 71
 
72 72
         // Order
73
-        $filterOrder = (array) $selectedFilter->order;
73
+        $filterOrder = (array)$selectedFilter->order;
74 74
 
75 75
         // See descendants
76 76
         $seeDescendants = request()->session()->get('descendants');
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             if ($relatedList && $relatedList->method) {
154 154
                 // Related list method
155 155
                 $method = $relatedList->method;
156
-                $recordIdsMethod = $method . 'RecordIds';
156
+                $recordIdsMethod = $method.'RecordIds';
157 157
 
158 158
                 // Get related records ids
159 159
                 $model = new $modelClass;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
                 // Add the record id itself to be filtered
163 163
                 if ($relatedList->module_id === $relatedList->related_module_id && !empty($recordId) && !$filteredRecordIds->contains($recordId)) {
164
-                    $filteredRecordIds[] = (int)$recordId;
164
+                    $filteredRecordIds[ ] = (int)$recordId;
165 165
                 }
166 166
 
167 167
                 // Make the quer
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             $records = $query->paginate($length);
173 173
         }
174 174
 
175
-        $records->getCollection()->transform(function ($record) use ($domain, $module) {
175
+        $records->getCollection()->transform(function($record) use ($domain, $module) {
176 176
             foreach ($module->fields as $field) {
177 177
                 // If a special template exists, use it. Else use the generic template
178 178
                 $uitype = uitype($field->uitype_id);
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         $results = collect();
217 217
         if (method_exists($modelClass, 'getSearchResult') && property_exists($modelClass, 'searchableColumns')) {
218 218
             $searchResults = new Search();
219
-            $searchResults->registerModel($modelClass, (array) (new $modelClass)->searchableColumns);
219
+            $searchResults->registerModel($modelClass, (array)(new $modelClass)->searchableColumns);
220 220
             $results = $searchResults->search($q)->take(config('uccello.max_results.autocomplete', 10));
221 221
         }
222 222
 
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
         $savePageLength = $request->input('save_page_length');
238 238
 
239 239
         // Optional data
240
-        $data = [];
240
+        $data = [ ];
241 241
         if ($savePageLength) {
242
-            $data["length"] = $request->input('page_length');
242
+            $data[ "length" ] = $request->input('page_length');
243 243
         }
244 244
 
245 245
         $filter = Filter::firstOrNew([
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
     protected function addSearchConditions($filter)
332 332
     {
333 333
         if ($this->request->has('search')) {
334
-            $conditions = [];
335
-            foreach ((array) $this->request->search as $fieldName => $value) {
336
-                $conditions[$fieldName] = $value;
334
+            $conditions = [ ];
335
+            foreach ((array)$this->request->search as $fieldName => $value) {
336
+                $conditions[ $fieldName ] = $value;
337 337
             }
338 338
 
339 339
             if ($conditions) {
Please login to merge, or discard this patch.