@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ]; |
59 | 59 | |
60 | 60 | // We want the field displays the datetime in the good format |
61 | - $options['value'] = $this->getFormattedValueToDisplay($field, $record); |
|
61 | + $options[ 'value' ] = $this->getFormattedValueToDisplay($field, $record); |
|
62 | 62 | |
63 | 63 | return $options; |
64 | 64 | } |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | public function addConditionToSearchQuery(Builder $query, Field $field, $value) : Builder |
124 | 124 | { |
125 | 125 | if (!$this->isEmptyOrNotEmptySearchQuery($query, $field, $value)) { |
126 | - $query->where(function ($query) use($field, $value) { |
|
126 | + $query->where(function($query) use($field, $value) { |
|
127 | 127 | $values = explode(',', $value); // Start Date, End Date |
128 | - $dateStart = \Carbon\Carbon::createFromFormat(config('uccello.format.php.datetime'), trim($values[0])); |
|
129 | - $dateEnd = \Carbon\Carbon::createFromFormat(config('uccello.format.php.datetime'), trim($values[1])); |
|
128 | + $dateStart = \Carbon\Carbon::createFromFormat(config('uccello.format.php.datetime'), trim($values[ 0 ])); |
|
129 | + $dateEnd = \Carbon\Carbon::createFromFormat(config('uccello.format.php.datetime'), trim($values[ 1 ])); |
|
130 | 130 | $query->whereBetween($field->column, [ $dateStart, $dateEnd ])->get(); |
131 | 131 | }); |
132 | 132 | } |
@@ -82,8 +82,7 @@ |
||
82 | 82 | { |
83 | 83 | if (empty($data['conditions'])) { |
84 | 84 | $data['conditions'] = []; |
85 | - } |
|
86 | - else { |
|
85 | + } else { |
|
87 | 86 | $data['conditions'] = (array) $data['conditions']; |
88 | 87 | } |
89 | 88 |
@@ -78,24 +78,24 @@ |
||
78 | 78 | $filter = new static(); |
79 | 79 | |
80 | 80 | // Refactor $data to mach match 'conditions' filter format... |
81 | - if(!empty($data['columns']) && is_array($data['columns']) && is_array(reset($data['columns']))) |
|
81 | + if (!empty($data[ 'columns' ]) && is_array($data[ 'columns' ]) && is_array(reset($data[ 'columns' ]))) |
|
82 | 82 | { |
83 | - if (empty($data['conditions'])) { |
|
84 | - $data['conditions'] = []; |
|
83 | + if (empty($data[ 'conditions' ])) { |
|
84 | + $data[ 'conditions' ] = [ ]; |
|
85 | 85 | } |
86 | 86 | else { |
87 | - $data['conditions'] = (array) $data['conditions']; |
|
87 | + $data[ 'conditions' ] = (array)$data[ 'conditions' ]; |
|
88 | 88 | } |
89 | 89 | |
90 | - foreach ($data['columns'] as $fieldName => $field) { |
|
90 | + foreach ($data[ 'columns' ] as $fieldName => $field) { |
|
91 | 91 | foreach ($field as $key => $value) { |
92 | 92 | if (!empty($value) && $key != 'columnName') { |
93 | - $data['conditions'][$key][$fieldName] = $value; |
|
93 | + $data[ 'conditions' ][ $key ][ $fieldName ] = $value; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - unset($data['columns']); |
|
98 | + unset($data[ 'columns' ]); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | foreach ($data as $key => $value) { |
@@ -61,17 +61,17 @@ |
||
61 | 61 | |
62 | 62 | public function parentGroups() |
63 | 63 | { |
64 | - return $this->belongsToMany(static::class, $this->tablePrefix . 'rl_groups_groups', 'children_id', 'parent_id'); |
|
64 | + return $this->belongsToMany(static::class, $this->tablePrefix.'rl_groups_groups', 'children_id', 'parent_id'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | public function childrenGroups() |
68 | 68 | { |
69 | - return $this->belongsToMany(static::class, $this->tablePrefix . 'rl_groups_groups', 'parent_id', 'children_id'); |
|
69 | + return $this->belongsToMany(static::class, $this->tablePrefix.'rl_groups_groups', 'parent_id', 'children_id'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | public function users() |
73 | 73 | { |
74 | - return $this->belongsToMany(User::class, $this->tablePrefix . 'rl_groups_users'); |
|
74 | + return $this->belongsToMany(User::class, $this->tablePrefix.'rl_groups_users'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -63,7 +63,7 @@ |
||
63 | 63 | // With conditions |
64 | 64 | if ($request->input('with_conditions') === '1') { |
65 | 65 | // TODO: Build $conditions['search'] earlier in the export process to match filter format... |
66 | - $conditions = ['search' => json_decode($request->input('conditions'))]; |
|
66 | + $conditions = [ 'search' => json_decode($request->input('conditions')) ]; |
|
67 | 67 | $export = $export->withConditions($conditions); |
68 | 68 | } |
69 | 69 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function down() |
27 | 27 | { |
28 | - Schema::table($this->tablePrefix . 'filters', function (Blueprint $table) { |
|
28 | + Schema::table($this->tablePrefix.'filters', function(Blueprint $table) { |
|
29 | 29 | $table->renameColumn('order', 'order_by'); |
30 | 30 | }); |
31 | 31 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <div class="autoscroll-x"> |
2 | - <?php $filterOrder = !empty($selectedFilter) ? (array) $selectedFilter->order : []; ?> |
|
2 | + <?php $filterOrder = !empty($selectedFilter) ? (array)$selectedFilter->order : [ ]; ?> |
|
3 | 3 | <table |
4 | 4 | id="{{ $datatableId }}" |
5 | 5 | class="striped highlight" |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | <div class="search hide-on-small-only hide-on-med-only"> |
32 | 32 | <?php |
33 | 33 | $searchValue = null; |
34 | - if (!empty($selectedFilter) && !empty($selectedFilter->conditions->search->{$column['name']})) { |
|
35 | - $searchValue = $selectedFilter->conditions->search->{$column['name']}; |
|
34 | + if (!empty($selectedFilter) && !empty($selectedFilter->conditions->search->{$column[ 'name' ]})) { |
|
35 | + $searchValue = $selectedFilter->conditions->search->{$column[ 'name' ]}; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // If a special template exists, use it. Else use the generic template |
39 | 39 | $uitypeViewName = sprintf('uitypes.search.%s', $column[ 'uitype' ]); |
40 | 40 | $uitypeFallbackView = 'uccello::modules.default.uitypes.search.text'; |
41 | 41 | $uitypeViewToInclude = uccello()->view($column[ 'package' ], $module, $uitypeViewName, $uitypeFallbackView); |
42 | - $field = $module->fields()->where('name', $column['name'])->first(); |
|
42 | + $field = $module->fields()->where('name', $column[ 'name' ])->first(); |
|
43 | 43 | ?> |
44 | 44 | @include($uitypeViewToInclude, [ 'field' => $field ]) |
45 | 45 | </div> |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | // Related field |
35 | 35 | $relatedField = $relatedList->relatedField; |
36 | - $filter = ['order' => request('order')]; |
|
36 | + $filter = [ 'order' => request('order') ]; |
|
37 | 37 | |
38 | 38 | $query = $query->where($relatedField->column, $recordId) |
39 | 39 | ->filterBy($filter); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $relationName = $relatedList->relationName; |
75 | 75 | |
76 | 76 | $record = $modelClass::find($recordId); |
77 | - $filter = ['order' => request('order')]; |
|
77 | + $filter = [ 'order' => request('order') ]; |
|
78 | 78 | |
79 | 79 | $query = $record->$relationName() |
80 | 80 | ->filterBy($filter); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param Module $module |
76 | 76 | * @param boolean $forBlade |
77 | 77 | */ |
78 | - protected function preProcess(?Domain &$domain, Module $module, Request $request, $forBlade=true) |
|
78 | + protected function preProcess(?Domain &$domain, Module $module, Request $request, $forBlade = true) |
|
79 | 79 | { |
80 | 80 | // If we don't use multi domains, find the first one |
81 | 81 | if (!uccello()->useMultiDomains()) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | $keyName = $getAdminModules ? 'modules_all' : 'modules_not_admin'; |
155 | 155 | |
156 | - return Cache::rememberForever($keyName, function () use($getAdminModules) { |
|
156 | + return Cache::rememberForever($keyName, function() use($getAdminModules) { |
|
157 | 157 | $modules = [ ]; |
158 | 158 | |
159 | 159 | $allModules = Module::all(); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | $i = 0; |
154 | 154 | foreach ($words as $w) { |
155 | - $initials .= $w[0]; |
|
155 | + $initials .= $w[ 0 ]; |
|
156 | 156 | $i++; |
157 | 157 | |
158 | 158 | if ($i === 3) { // Maximum: 3 letters |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $image = 'vendor/uccello/uccello/images/user-no-image.png'; |
174 | 174 | |
175 | 175 | if ($this->avatarType === 'gravatar') { |
176 | - $image = 'https://www.gravatar.com/avatar/' . md5($this->email) . '?d=mm'; |
|
176 | + $image = 'https://www.gravatar.com/avatar/'.md5($this->email).'?d=mm'; |
|
177 | 177 | |
178 | 178 | } elseif ($this->avatarType === 'image' && !empty($this->avatar->path)) { |
179 | 179 | $image = $this->avatar->path; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @param mixed $defaultValue |
200 | 200 | * @return \stdClass|null; |
201 | 201 | */ |
202 | - public function getSettings($key, $defaultValue=null) { |
|
202 | + public function getSettings($key, $defaultValue = null) { |
|
203 | 203 | return $this->userSettings->data->{$key} ?? $defaultValue; |
204 | 204 | } |
205 | 205 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function rolesOnDomain($domain) : Collection |
213 | 213 | { |
214 | - return Cache::remember('user_'.$this->id.'_domain_'.$domain->slug.'roles', 600, function () use($domain) { |
|
214 | + return Cache::remember('user_'.$this->id.'_domain_'.$domain->slug.'roles', 600, function() use($domain) { |
|
215 | 215 | $roles = collect(); |
216 | 216 | |
217 | 217 | if (config('uccello.roles.display_ancestors_roles')) { |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | |
260 | 260 | $hasRole = false; |
261 | 261 | |
262 | - $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function () use($domain) { |
|
262 | + $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function() use($domain) { |
|
263 | 263 | return $domain->findDescendants()->get(); |
264 | 264 | }); |
265 | 265 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | { |
286 | 286 | $keyName = 'user_'.$this->id.'_'.$domain->slug.'_'.$module->name.'_capabilities'; |
287 | 287 | |
288 | - return Cache::remember($keyName, 600, function () use($domain, $module) { |
|
288 | + return Cache::remember($keyName, 600, function() use($domain, $module) { |
|
289 | 289 | $capabilities = collect(); |
290 | 290 | |
291 | 291 | // Get the domain and all its parents |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | |
340 | 340 | $keyName = 'user_'.$this->id.'_'.$domain->slug.'_can_access_to_settings_panel'; |
341 | 341 | |
342 | - return Cache::remember($keyName, 600, function () use($domain) { |
|
342 | + return Cache::remember($keyName, 600, function() use($domain) { |
|
343 | 343 | |
344 | 344 | $hasCapability = false; |
345 | 345 | |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | { |
492 | 492 | // Use cache |
493 | 493 | $allowedGroups = Cache::rememberForever( |
494 | - 'allowed_groups_for_' . ($this->is_admin ? 'admin' : $this->getKey()), |
|
495 | - function () { |
|
494 | + 'allowed_groups_for_'.($this->is_admin ? 'admin' : $this->getKey()), |
|
495 | + function() { |
|
496 | 496 | return $this->getAllowedGroupUuidsProcess(); |
497 | 497 | } |
498 | 498 | ); |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | { |
505 | 505 | // Use cache |
506 | 506 | $allowedGroupsAndUsers = Cache::rememberForever( |
507 | - 'allowed_group_users_for_' . ($addUsers ? 'u_' : '') . ($this->is_admin ? 'admin' : $this->getKey()), |
|
508 | - function () use ($addUsers) { |
|
507 | + 'allowed_group_users_for_'.($addUsers ? 'u_' : '').($this->is_admin ? 'admin' : $this->getKey()), |
|
508 | + function() use ($addUsers) { |
|
509 | 509 | return $this->getAllowedGroupsAndUsersProcess($addUsers); |
510 | 510 | } |
511 | 511 | ); |
@@ -515,16 +515,16 @@ discard block |
||
515 | 515 | |
516 | 516 | protected function getAllowedGroupUuidsProcess() |
517 | 517 | { |
518 | - $allowedUserUuids = collect([$this->uuid]); |
|
518 | + $allowedUserUuids = collect([ $this->uuid ]); |
|
519 | 519 | |
520 | 520 | if ($this->is_admin) { |
521 | 521 | $groups = Group::all(); |
522 | 522 | } else { |
523 | - $groups = []; |
|
524 | - $users = []; |
|
523 | + $groups = [ ]; |
|
524 | + $users = [ ]; |
|
525 | 525 | |
526 | 526 | foreach ($this->groups as $group) { |
527 | - $groups[$group->uuid] = $group; |
|
527 | + $groups[ $group->uuid ] = $group; |
|
528 | 528 | }; |
529 | 529 | |
530 | 530 | $this->addRecursiveChildrenGroups($groups, $users, $groups, false); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | |
535 | 535 | foreach ($groups as $uuid => $group) { |
536 | - $allowedUserUuids[] = $uuid; |
|
536 | + $allowedUserUuids[ ] = $uuid; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | return $allowedUserUuids; |
@@ -542,19 +542,19 @@ discard block |
||
542 | 542 | protected function addRecursiveChildrenGroups(&$groups, &$users, $searchGroups, $addUsers = false) |
543 | 543 | { |
544 | 544 | foreach ($searchGroups as $uuid => $searchGroup) { |
545 | - $searchChildrenGroups = []; |
|
545 | + $searchChildrenGroups = [ ]; |
|
546 | 546 | |
547 | 547 | foreach ($searchGroup->childrenGroups as $childrenGroup) { |
548 | - if (empty($groups[$childrenGroup->uuid])) { |
|
549 | - $groups[$childrenGroup->uuid] = $childrenGroup; |
|
550 | - $searchChildrenGroups[$childrenGroup->uuid] = $childrenGroup; |
|
548 | + if (empty($groups[ $childrenGroup->uuid ])) { |
|
549 | + $groups[ $childrenGroup->uuid ] = $childrenGroup; |
|
550 | + $searchChildrenGroups[ $childrenGroup->uuid ] = $childrenGroup; |
|
551 | 551 | } |
552 | 552 | |
553 | - if($addUsers) |
|
553 | + if ($addUsers) |
|
554 | 554 | { |
555 | 555 | foreach ($childrenGroup->users as $user) { |
556 | - if (empty($users[$user->uuid])) { |
|
557 | - $users[$user->uuid] = $user; |
|
556 | + if (empty($users[ $user->uuid ])) { |
|
557 | + $users[ $user->uuid ] = $user; |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 | } |
@@ -566,26 +566,26 @@ discard block |
||
566 | 566 | |
567 | 567 | protected function getAllowedGroupsAndUsersProcess($addUsers = true) |
568 | 568 | { |
569 | - $allowedUserUuids = collect([[ |
|
569 | + $allowedUserUuids = collect([ [ |
|
570 | 570 | 'uuid' => $this->uuid, |
571 | 571 | 'recordLabel' => uctrans('me', $this->module) |
572 | - ]]); |
|
572 | + ] ]); |
|
573 | 573 | |
574 | 574 | if ($this->is_admin) { |
575 | 575 | $groups = Group::orderBy('name')->get(); |
576 | 576 | $users = \App\User::orderBy('name')->get(); |
577 | 577 | } else { |
578 | - $groups = []; |
|
579 | - $users = []; |
|
578 | + $groups = [ ]; |
|
579 | + $users = [ ]; |
|
580 | 580 | |
581 | 581 | foreach ($this->groups as $group) { |
582 | - $groups[$group->uuid] = $group; |
|
582 | + $groups[ $group->uuid ] = $group; |
|
583 | 583 | |
584 | - if($addUsers) |
|
584 | + if ($addUsers) |
|
585 | 585 | { |
586 | 586 | foreach ($group->users as $user) { |
587 | - if (empty($users[$user->uuid])) { |
|
588 | - $users[$user->uuid] = $user; |
|
587 | + if (empty($users[ $user->uuid ])) { |
|
588 | + $users[ $user->uuid ] = $user; |
|
589 | 589 | } |
590 | 590 | } |
591 | 591 | } |
@@ -598,15 +598,15 @@ discard block |
||
598 | 598 | } |
599 | 599 | |
600 | 600 | foreach ($groups as $uuid => $group) { |
601 | - $allowedUserUuids[] = [ |
|
601 | + $allowedUserUuids[ ] = [ |
|
602 | 602 | 'uuid' => $group->uuid, |
603 | 603 | 'recordLabel' => $group->recordLabel |
604 | 604 | ]; |
605 | 605 | } |
606 | 606 | |
607 | 607 | foreach ($users as $uuid => $user) { |
608 | - if($user->getKey() != $this->getKey()) { |
|
609 | - $allowedUserUuids[] = [ |
|
608 | + if ($user->getKey() != $this->getKey()) { |
|
609 | + $allowedUserUuids[ ] = [ |
|
610 | 610 | 'uuid' => $user->uuid, |
611 | 611 | 'recordLabel' => $user->recordLabel |
612 | 612 | ]; |