@@ -67,7 +67,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -52,7 +52,7 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -25,11 +25,11 @@ |
||
25 | 25 | 'creator_id', |
26 | 26 | ]; |
27 | 27 | |
28 | - protected $primaryKey = 'id'; // TODO: Change to "uid" to make joins withs modules tables possible ??? |
|
28 | + protected $primaryKey = 'id'; // TODO: Change to "uid" to make joins withs modules tables possible ??? |
|
29 | 29 | public $incrementing = false; |
30 | 30 | |
31 | 31 | // Allow Eloquent to return id as string instead of int. |
32 | - protected $casts = ['id' => 'string']; |
|
32 | + protected $casts = [ 'id' => 'string' ]; |
|
33 | 33 | |
34 | 34 | protected function initTablePrefix() |
35 | 35 | { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function getFormattedValueToDisplay(Field $field, $record) : string |
76 | 76 | { |
77 | 77 | if (isset($field->data->multiple) && $field->data->multiple === true && !empty($record->{$field->column})) { |
78 | - $values = []; |
|
78 | + $values = [ ]; |
|
79 | 79 | |
80 | 80 | $fieldValues = json_decode($record->{$field->column}); |
81 | 81 | if (is_array($fieldValues)) { |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | continue; |
85 | 85 | } |
86 | 86 | |
87 | - $values[] = uctrans($value, $field->module); |
|
87 | + $values[ ] = uctrans($value, $field->module); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | $value = implode(', ', $values); |
92 | 92 | } else { |
93 | - $value = parent::getFormattedValueToDisplay($field, $record); |
|
93 | + $value = parent::getFormattedValueToDisplay($field, $record); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | return $value; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | $roots = collect(); |
61 | 61 | foreach ($rootRecords as $record) { |
62 | - $roots[] = $this->getFormattedRecordToAdd($record); |
|
62 | + $roots[ ] = $this->getFormattedRecordToAdd($record); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $roots; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $children = collect(); |
86 | 86 | if ($parentRecord) { |
87 | 87 | foreach ($parentRecord->children()->get() as $record) { |
88 | - $children[] = $this->getFormattedRecordToAdd($record); |
|
88 | + $children[ ] = $this->getFormattedRecordToAdd($record); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | @if ($value) |
17 | 17 | <?php |
18 | 18 | $valueParts = explode(';', $value); |
19 | - $fileName = $valueParts[0]; |
|
19 | + $fileName = $valueParts[ 0 ]; |
|
20 | 20 | ?> |
21 | 21 | <div class="input-field current-file"> |
22 | 22 | <div class="file-container"> |
@@ -44,7 +44,7 @@ |
||
44 | 44 | foreach ($treeDomainsIds as $treeDomainId) { |
45 | 45 | $_domain = Domain::find($treeDomainId); |
46 | 46 | foreach ($_domain->roles as $role) { |
47 | - $roleName = $_domain->id === $domain->id ? $role->name : $_domain->name . ' > ' . $role->name; |
|
47 | + $roleName = $_domain->id === $domain->id ? $role->name : $_domain->name.' > '.$role->name; |
|
48 | 48 | $roles[ $role->id ] = $roleName; |
49 | 49 | } |
50 | 50 | } |
@@ -176,8 +176,8 @@ |
||
176 | 176 | } |
177 | 177 | // Several routes |
178 | 178 | elseif (is_array($this->data->menu)) { |
179 | - if (!empty($this->data->menu[0]->route)) { |
|
180 | - $defaultRoute = $this->data->menu[0]->route; |
|
179 | + if (!empty($this->data->menu[ 0 ]->route)) { |
|
180 | + $defaultRoute = $this->data->menu[ 0 ]->route; |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
@@ -109,7 +109,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ]; |