Passed
Push — master ( 3c78de...f5065f )
by Jonathan
16:41
created
database/migrations/2018_04_15_000036_create_user_settings_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function up()
18 18
     {
19
-        Schema::create($this->tablePrefix . 'user_settings', function (Blueprint $table) {
19
+        Schema::create($this->tablePrefix.'user_settings', function(Blueprint $table) {
20 20
             $table->unsignedInteger('user_id')->primary();
21 21
             $table->longText('data');
22 22
             $table->timestamps();
@@ -32,6 +32,6 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function down()
34 34
     {
35
-        Schema::dropIfExists($this->tablePrefix . 'user_settings');
35
+        Schema::dropIfExists($this->tablePrefix.'user_settings');
36 36
     }
37 37
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Core/EditController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $this->preProcess($domain, $module, $request);
161 161
 
162 162
         // Retrieve record
163
-        $recordId = (int) request('id');
163
+        $recordId = (int)request('id');
164 164
         $modelClass = $module->model_class;
165 165
         $record = $modelClass::onlyTrashed()->findOrFail($recordId);
166 166
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         }
173 173
 
174 174
         // Redirect to the trash list
175
-        $route = ucroute('uccello.list', $domain, $module, ['filter' => 'trash']);
175
+        $route = ucroute('uccello.list', $domain, $module, [ 'filter' => 'trash' ]);
176 176
         return redirect($route);
177 177
     }
178 178
 
@@ -306,15 +306,15 @@  discard block
 block discarded – undo
306 306
 
307 307
         // Redirect to source record if a relation was deleted
308 308
         if (isset($relatedlist) && $request->input('id')) {
309
-            $params = ['id' => $request->input('id')];
309
+            $params = [ 'id' => $request->input('id') ];
310 310
 
311 311
             // Add tab id if defined to select it automaticaly
312 312
             if ($request->input('tab')) {
313
-                $params['tab'] = $request->input('tab');
313
+                $params[ 'tab' ] = $request->input('tab');
314 314
             }
315 315
             // Add related list id to select the related tab automaticaly
316 316
             else {
317
-                $params['relatedlist'] = $relatedlist->id;
317
+                $params[ 'relatedlist' ] = $relatedlist->id;
318 318
             }
319 319
 
320 320
             $route = ucroute('uccello.detail', $domain, $relatedlist->module, $params);
Please login to merge, or discard this patch.
app/Http/Controllers/Core/ListController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
         // Get filters
49 49
         $filters = Filter::where('module_id', $module->id)  // Module
50 50
             ->where('type', 'list')                         // Type (list)
51
-            ->where(function ($query) use($domain) {        // Domain
51
+            ->where(function($query) use($domain) {        // Domain
52 52
                 $query->whereNull('domain_id')
53 53
                     ->orWhere('domain_id', $domain->getKey());
54 54
             })
55
-            ->where(function ($query) {                     // User
55
+            ->where(function($query) {                     // User
56 56
                 $query->where('is_public', true)
57
-                    ->orWhere(function ($query) {
57
+                    ->orWhere(function($query) {
58 58
                         $query->where('is_public', false)
59 59
                             ->where('user_id', '=', auth()->id());
60 60
                     })
61
-                    ->orWhere(function ($query) {
61
+                    ->orWhere(function($query) {
62 62
                         $query->where('is_public', false)
63 63
                             ->whereNull('user_id');
64 64
                     });
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             ->get();
68 68
 
69 69
         // Order
70
-        $filterOrder = (array) $selectedFilter->order;
70
+        $filterOrder = (array)$selectedFilter->order;
71 71
 
72 72
         // See descendants
73 73
         $seeDescendants = request()->session()->get('descendants');
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             if ($relatedList && $relatedList->method) {
151 151
                 // Related list method
152 152
                 $method = $relatedList->method;
153
-                $recordIdsMethod = $method . 'RecordIds';
153
+                $recordIdsMethod = $method.'RecordIds';
154 154
 
155 155
                 // Get related records ids
156 156
                 $model = new $modelClass;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
                 // Add the record id itself to be filtered
160 160
                 if ($relatedList->module_id === $relatedList->related_module_id && !empty($recordId) && !$filteredRecordIds->contains($recordId)) {
161
-                    $filteredRecordIds[] = (int)$recordId;
161
+                    $filteredRecordIds[ ] = (int)$recordId;
162 162
                 }
163 163
 
164 164
                 // Make the quer
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $records = $query->paginate($length);
170 170
         }
171 171
 
172
-        $records->getCollection()->transform(function ($record) use ($domain, $module) {
172
+        $records->getCollection()->transform(function($record) use ($domain, $module) {
173 173
             foreach ($module->fields as $field) {
174 174
                 // If a special template exists, use it. Else use the generic template
175 175
                 $uitype = uitype($field->uitype_id);
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         $results = collect();
214 214
         if (method_exists($modelClass, 'getSearchResult') && property_exists($modelClass, 'searchableColumns')) {
215 215
             $searchResults = new Search();
216
-            $searchResults->registerModel($modelClass, (array) (new $modelClass)->searchableColumns);
216
+            $searchResults->registerModel($modelClass, (array)(new $modelClass)->searchableColumns);
217 217
             $results = $searchResults->search($q)->take(config('uccello.max_results.autocomplete', 10));
218 218
         }
219 219
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
         $savePageLength = $request->input('save_page_length');
235 235
 
236 236
         // Optional data
237
-        $data = [];
237
+        $data = [ ];
238 238
         if ($savePageLength) {
239
-            $data["length"] = $request->input('page_length');
239
+            $data[ "length" ] = $request->input('page_length');
240 240
         }
241 241
 
242 242
         $filter = Filter::firstOrNew([
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('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('assigned_user_id', function ($query) use ($user) {
30
+            $builder->orWhereIn('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/Support/Traits/UccelloModule.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
         }
29 29
 
30 30
         // Create uuid after save
31
-        static::created(function ($model) {
31
+        static::created(function($model) {
32 32
             $module = Module::where('model_class', get_class($model))->first();
33 33
             if ($module) {
34 34
                 Entity::create([
35
-                    'id' => (string) Str::uuid(),
35
+                    'id' => (string)Str::uuid(),
36 36
                     'module_id' => $module->id,
37 37
                     'record_id' => $model->getKey(),
38 38
                     'creator_id' => auth()->id(),
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         });
42 42
 
43 43
         // Delete uuid after forced delete
44
-        static::deleted(function ($model) {
44
+        static::deleted(function($model) {
45 45
             if (!empty($model->uuid) && (!method_exists($model, 'isForceDeleting') || $model->isForceDeleting() === true)) {
46 46
                 $entity = Entity::find($model->uuid);
47 47
                 if ($entity) {
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function initializeUccelloModule()
55 55
     {
56
-        $this->appends = array_merge($this->appends, ['recordLabel','uuid']);
56
+        $this->appends = array_merge($this->appends, [ 'recordLabel', 'uuid' ]);
57 57
     }
58 58
 
59 59
     protected static function isFilteredByUser()
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
 
86 86
     protected static function getModuleFromClass($className)
87 87
     {
88
-        $modules = Cache::rememberForever('modules_by_model_class', function () {
88
+        $modules = Cache::rememberForever('modules_by_model_class', function() {
89 89
             $modulesGroupedByModelClass = collect();
90
-            Module::all()->map(function ($item) use ($modulesGroupedByModelClass) {
91
-                $modulesGroupedByModelClass[$item->model_class] = $item;
90
+            Module::all()->map(function($item) use ($modulesGroupedByModelClass) {
91
+                $modulesGroupedByModelClass[ $item->model_class ] = $item;
92 92
                 return $modulesGroupedByModelClass;
93 93
             });
94 94
             return $modulesGroupedByModelClass;
95 95
         });
96
-        return $modules[(string) $className] ?? null;
96
+        return $modules[ (string)$className ] ?? null;
97 97
     }
98 98
 
99 99
     public function getUuidAttribute()
Please login to merge, or discard this patch.
app/Models/Domain.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         parent::boot();
68 68
 
69 69
         // Linck to parent record
70
-        static::created(function ($model) {
70
+        static::created(function($model) {
71 71
             static::linkToParentRecord($model);
72 72
         });
73 73
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         //     static::linkToParentRecord($model);
76 76
         // });
77 77
 
78
-        static::updated(function ($model) {
78
+        static::updated(function($model) {
79 79
             static::linkToParentRecord($model);
80 80
         });
81 81
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     public function isRoot()
104 104
     {
105 105
         // return (empty($this->{$this->getTreeColumn('parent')})) ? true : false;
106
-        return $this->{$this->getTreeColumn('path')} === $this->getKey() . '/'
106
+        return $this->{$this->getTreeColumn('path')} === $this->getKey().'/'
107 107
                 && $this->{$this->getTreeColumn('level')} === 0;
108 108
     }
109 109
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      */
234 234
     protected function getNotAdminModulesAttribute() : array
235 235
     {
236
-        return Cache::rememberForever('not_admin_modules', function () {
236
+        return Cache::rememberForever('not_admin_modules', function() {
237 237
             $modules = [ ];
238 238
 
239 239
             foreach ($this->modules()->get() as $module) {
Please login to merge, or discard this patch.
app/Models/Module.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -174,8 +174,8 @@
 block discarded – undo
174 174
             }
175 175
             // Several routes
176 176
             elseif (is_array($this->data->menu)) {
177
-                if (!empty($this->data->menu[0]->route)) {
178
-                    $defaultRoute = $this->data->menu[0]->route;
177
+                if (!empty($this->data->menu[ 0 ]->route)) {
178
+                    $defaultRoute = $this->data->menu[ 0 ]->route;
179 179
                 }
180 180
             }
181 181
             // No route wanted
Please login to merge, or discard this patch.
app/Models/User.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
         $i = 0;
153 153
         foreach ($words as $w) {
154
-            $initials .= $w[0];
154
+            $initials .= $w[ 0 ];
155 155
             $i++;
156 156
 
157 157
             if ($i === 3) { // Maximum: 3 letters
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         $image = 'vendor/uccello/uccello/images/user-no-image.png';
173 173
 
174 174
         if ($this->avatarType === 'gravatar') {
175
-            $image = 'https://www.gravatar.com/avatar/' . md5($this->email) . '?d=mm';
175
+            $image = 'https://www.gravatar.com/avatar/'.md5($this->email).'?d=mm';
176 176
 
177 177
         } elseif ($this->avatarType === 'image' && !empty($this->avatar->path)) {
178 178
             $image = $this->avatar->path;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      * @param mixed $defaultValue
199 199
      * @return \stdClass|null;
200 200
      */
201
-    public function getSettings($key, $defaultValue=null) {
201
+    public function getSettings($key, $defaultValue = null) {
202 202
         return $this->userSettings->data->{$key} ?? $defaultValue;
203 203
     }
204 204
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
         $hasRole = false;
278 278
 
279
-        $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function () use($domain) {
279
+        $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function() use($domain) {
280 280
             return $domain->findDescendants()->get();
281 281
         });
282 282
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     {
303 303
         $keyName = 'user_'.$this->id.'_'.$domain->slug.'_'.$module->name.'_capabilities';
304 304
 
305
-        return Cache::remember($keyName, 600, function () use($domain, $module) {
305
+        return Cache::remember($keyName, 600, function() use($domain, $module) {
306 306
             $capabilities = collect();
307 307
 
308 308
             // Get the domain and all its parents
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
         $keyName = 'user_'.$this->id.'_'.$domain->slug.'_can_access_to_settings_panel';
358 358
 
359
-        return Cache::remember($keyName, 600, function () use($domain) {
359
+        return Cache::remember($keyName, 600, function() use($domain) {
360 360
 
361 361
             $hasCapability = false;
362 362
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
     {
509 509
         // Use cache
510 510
         $allowedGroups = Cache::rememberForever(
511
-            'allowed_groups_for_' . ($this->is_admin ? 'admin' : $this->getKey()),
512
-            function () {
511
+            'allowed_groups_for_'.($this->is_admin ? 'admin' : $this->getKey()),
512
+            function() {
513 513
                 return $this->getAllowedGroupUuidsProcess();
514 514
             }
515 515
         );
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
     {
522 522
         // Use cache
523 523
         $allowedGroupsAndUsers = Cache::rememberForever(
524
-            'allowed_group_users_for_' . ($addUsers ? 'u_' : '') . ($this->is_admin ? 'admin' : $this->getKey()),
525
-            function () use ($addUsers) {
524
+            'allowed_group_users_for_'.($addUsers ? 'u_' : '').($this->is_admin ? 'admin' : $this->getKey()),
525
+            function() use ($addUsers) {
526 526
                 return $this->getAllowedGroupsAndUsersProcess($addUsers);
527 527
             }
528 528
         );
@@ -532,16 +532,16 @@  discard block
 block discarded – undo
532 532
 
533 533
     protected function getAllowedGroupUuidsProcess()
534 534
     {
535
-        $allowedUserUuids = collect([$this->uuid]);
535
+        $allowedUserUuids = collect([ $this->uuid ]);
536 536
 
537 537
         if ($this->is_admin) {
538 538
             $groups = Group::all();
539 539
         } else {
540
-            $groups = [];
541
-            $users = [];
540
+            $groups = [ ];
541
+            $users = [ ];
542 542
 
543 543
             foreach ($this->groups as $group) {
544
-                $groups[$group->uuid] = $group;
544
+                $groups[ $group->uuid ] = $group;
545 545
             };
546 546
 
547 547
             $this->addRecursiveChildrenGroups($groups, $users, $groups, false);
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         }
551 551
 
552 552
         foreach ($groups as $uuid => $group) {
553
-            $allowedUserUuids[] = $uuid;
553
+            $allowedUserUuids[ ] = $uuid;
554 554
         }
555 555
 
556 556
         return $allowedUserUuids;
@@ -559,19 +559,19 @@  discard block
 block discarded – undo
559 559
     protected function addRecursiveChildrenGroups(&$groups, &$users, $searchGroups, $addUsers = false)
560 560
     {
561 561
         foreach ($searchGroups as $uuid => $searchGroup) {
562
-            $searchChildrenGroups = [];
562
+            $searchChildrenGroups = [ ];
563 563
 
564 564
             foreach ($searchGroup->childrenGroups as $childrenGroup) {
565
-                if (empty($groups[$childrenGroup->uuid])) {
566
-                    $groups[$childrenGroup->uuid] = $childrenGroup;
567
-                    $searchChildrenGroups[$childrenGroup->uuid] = $childrenGroup;
565
+                if (empty($groups[ $childrenGroup->uuid ])) {
566
+                    $groups[ $childrenGroup->uuid ] = $childrenGroup;
567
+                    $searchChildrenGroups[ $childrenGroup->uuid ] = $childrenGroup;
568 568
                 }
569 569
 
570
-                if($addUsers)
570
+                if ($addUsers)
571 571
                 {
572 572
                     foreach ($childrenGroup->users as $user) {
573
-                        if (empty($users[$user->uuid])) {
574
-                            $users[$user->uuid] = $user;
573
+                        if (empty($users[ $user->uuid ])) {
574
+                            $users[ $user->uuid ] = $user;
575 575
                         }
576 576
                     }
577 577
                 }
@@ -583,10 +583,10 @@  discard block
 block discarded – undo
583 583
 
584 584
     protected function getAllowedGroupsAndUsersProcess($addUsers = true)
585 585
     {
586
-        $allowedUserUuids = collect([[
586
+        $allowedUserUuids = collect([ [
587 587
             'uuid' => $this->uuid,
588 588
             'recordLabel' => uctrans('me', $this->module)
589
-        ]]);
589
+        ] ]);
590 590
 
591 591
         // if ($this->is_admin) {
592 592
             $groups = Group::orderBy('name')->get();
@@ -615,15 +615,15 @@  discard block
 block discarded – undo
615 615
         // }
616 616
 
617 617
         foreach ($groups as $uuid => $group) {
618
-            $allowedUserUuids[] = [
618
+            $allowedUserUuids[ ] = [
619 619
                 'uuid' => $group->uuid,
620 620
                 'recordLabel' => $group->recordLabel
621 621
             ];
622 622
         }
623 623
 
624 624
         foreach ($users as $uuid => $user) {
625
-            if($user->getKey() != $this->getKey()) {
626
-                $allowedUserUuids[] = [
625
+            if ($user->getKey() != $this->getKey()) {
626
+                $allowedUserUuids[ ] = [
627 627
                     'uuid' => $user->uuid,
628 628
                     'recordLabel' => $user->recordLabel
629 629
                 ];
Please login to merge, or discard this patch.
app/Models/Role.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         parent::boot();
53 53
 
54 54
         // Linck to parent record
55
-        static::created(function ($model) {
55
+        static::created(function($model) {
56 56
             static::linkToParentRecord($model);
57 57
         });
58 58
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         //     static::linkToParentRecord($model);
61 61
         // });
62 62
 
63
-        static::updated(function ($model) {
63
+        static::updated(function($model) {
64 64
             static::linkToParentRecord($model);
65 65
         });
66 66
     }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     public function isRoot()
88 88
     {
89 89
         // return (empty($this->{$this->getTreeColumn('parent')})) ? true : false;
90
-        return $this->{$this->getTreeColumn('path')} === $this->getKey() . '/'
90
+        return $this->{$this->getTreeColumn('path')} === $this->getKey().'/'
91 91
                 && $this->{$this->getTreeColumn('level')} === 0;
92 92
     }
93 93
 
Please login to merge, or discard this patch.