@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | $i = 0; |
149 | 149 | foreach ($words as $w) { |
150 | - $initials .= $w[0]; |
|
150 | + $initials .= $w[ 0 ]; |
|
151 | 151 | $i++; |
152 | 152 | |
153 | 153 | if ($i === 3) { // Maximum: 3 letters |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $image = 'vendor/uccello/uccello/images/user-no-image.png'; |
169 | 169 | |
170 | 170 | if ($this->avatarType === 'gravatar') { |
171 | - $image = 'https://www.gravatar.com/avatar/' . md5($this->email) . '?d=mm'; |
|
171 | + $image = 'https://www.gravatar.com/avatar/'.md5($this->email).'?d=mm'; |
|
172 | 172 | |
173 | 173 | } elseif ($this->avatarType === 'image' && !empty($this->avatar->path)) { |
174 | 174 | $image = $this->avatar->path; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function rolesOnDomain($domain) : Collection |
187 | 187 | { |
188 | - return Cache::remember('domain_'.$domain->slug.'_roles', 600, function () use($domain) { |
|
188 | + return Cache::remember('domain_'.$domain->slug.'_roles', 600, function() use($domain) { |
|
189 | 189 | $roles = collect(); |
190 | 190 | |
191 | 191 | if (config('uccello.roles.display_ancestors_roles')) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | $hasRole = false; |
235 | 235 | |
236 | - $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function () use($domain) { |
|
236 | + $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function() use($domain) { |
|
237 | 237 | return $domain->findDescendants()->get(); |
238 | 238 | }); |
239 | 239 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | { |
260 | 260 | $keyName = 'user_'.$this->id.'_'.$domain->slug.'_'.$module->name.'_capabilities'; |
261 | 261 | |
262 | - return Cache::remember($keyName, 600, function () use($domain, $module) { |
|
262 | + return Cache::remember($keyName, 600, function() use($domain, $module) { |
|
263 | 263 | $capabilities = collect(); |
264 | 264 | |
265 | 265 | // Get the domain and all its parents |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | $keyName = 'user_'.$this->id.'_'.$domain->slug.'_can_access_to_settings_panel'; |
315 | 315 | |
316 | - return Cache::remember($keyName, 600, function () use($domain) { |
|
316 | + return Cache::remember($keyName, 600, function() use($domain) { |
|
317 | 317 | |
318 | 318 | $hasCapability = false; |
319 | 319 | |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | { |
466 | 466 | // Use cache |
467 | 467 | $allowedGroups = Cache::rememberForever( |
468 | - 'allowed_groups_for_' . ($this->is_admin ? 'admin' : $this->getKey()), |
|
469 | - function () { |
|
468 | + 'allowed_groups_for_'.($this->is_admin ? 'admin' : $this->getKey()), |
|
469 | + function() { |
|
470 | 470 | return $this->getAllowedGroupUuidsProcess(); |
471 | 471 | } |
472 | 472 | ); |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | { |
479 | 479 | // Use cache |
480 | 480 | $allowedGroupsAndUsers = Cache::rememberForever( |
481 | - 'allowed_group_users_for_' . ($addUsers ? 'u_' : '') . ($this->is_admin ? 'admin' : $this->getKey()), |
|
482 | - function () use ($addUsers) { |
|
481 | + 'allowed_group_users_for_'.($addUsers ? 'u_' : '').($this->is_admin ? 'admin' : $this->getKey()), |
|
482 | + function() use ($addUsers) { |
|
483 | 483 | return $this->getAllowedGroupsAndUsersProcess($addUsers); |
484 | 484 | } |
485 | 485 | ); |
@@ -489,16 +489,16 @@ discard block |
||
489 | 489 | |
490 | 490 | protected function getAllowedGroupUuidsProcess() |
491 | 491 | { |
492 | - $allowedUserUuids = collect([$this->uuid]); |
|
492 | + $allowedUserUuids = collect([ $this->uuid ]); |
|
493 | 493 | |
494 | 494 | if ($this->is_admin) { |
495 | 495 | $groups = Group::all(); |
496 | 496 | } else { |
497 | - $groups = []; |
|
498 | - $users = []; |
|
497 | + $groups = [ ]; |
|
498 | + $users = [ ]; |
|
499 | 499 | |
500 | 500 | foreach ($this->groups as $group) { |
501 | - $groups[$group->uuid] = $group; |
|
501 | + $groups[ $group->uuid ] = $group; |
|
502 | 502 | }; |
503 | 503 | |
504 | 504 | $this->addRecursiveChildrenGroups($groups, $users, $groups, false); |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | } |
508 | 508 | |
509 | 509 | foreach ($groups as $uuid => $group) { |
510 | - $allowedUserUuids[] = $uuid; |
|
510 | + $allowedUserUuids[ ] = $uuid; |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | return $allowedUserUuids; |
@@ -516,19 +516,19 @@ discard block |
||
516 | 516 | protected function addRecursiveChildrenGroups(&$groups, &$users, $searchGroups, $addUsers = false) |
517 | 517 | { |
518 | 518 | foreach ($searchGroups as $uuid => $searchGroup) { |
519 | - $searchChildrenGroups = []; |
|
519 | + $searchChildrenGroups = [ ]; |
|
520 | 520 | |
521 | 521 | foreach ($searchGroup->childrenGroups as $childrenGroup) { |
522 | - if (empty($groups[$childrenGroup->uuid])) { |
|
523 | - $groups[$childrenGroup->uuid] = $childrenGroup; |
|
524 | - $searchChildrenGroups[$childrenGroup->uuid] = $childrenGroup; |
|
522 | + if (empty($groups[ $childrenGroup->uuid ])) { |
|
523 | + $groups[ $childrenGroup->uuid ] = $childrenGroup; |
|
524 | + $searchChildrenGroups[ $childrenGroup->uuid ] = $childrenGroup; |
|
525 | 525 | } |
526 | 526 | |
527 | - if($addUsers) |
|
527 | + if ($addUsers) |
|
528 | 528 | { |
529 | 529 | foreach ($childrenGroup->users as $user) { |
530 | - if (empty($users[$user->uuid])) { |
|
531 | - $users[$user->uuid] = $user; |
|
530 | + if (empty($users[ $user->uuid ])) { |
|
531 | + $users[ $user->uuid ] = $user; |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | } |
@@ -540,26 +540,26 @@ discard block |
||
540 | 540 | |
541 | 541 | protected function getAllowedGroupsAndUsersProcess($addUsers = true) |
542 | 542 | { |
543 | - $allowedUserUuids = collect([[ |
|
543 | + $allowedUserUuids = collect([ [ |
|
544 | 544 | 'uuid' => $this->uuid, |
545 | 545 | 'recordLabel' => uctrans('me', $this->module) |
546 | - ]]); |
|
546 | + ] ]); |
|
547 | 547 | |
548 | 548 | if ($this->is_admin) { |
549 | 549 | $groups = Group::orderBy('name')->get(); |
550 | 550 | $users = \App\User::orderBy('name')->get(); |
551 | 551 | } else { |
552 | - $groups = []; |
|
553 | - $users = []; |
|
552 | + $groups = [ ]; |
|
553 | + $users = [ ]; |
|
554 | 554 | |
555 | 555 | foreach ($this->groups as $group) { |
556 | - $groups[$group->uuid] = $group; |
|
556 | + $groups[ $group->uuid ] = $group; |
|
557 | 557 | |
558 | - if($addUsers) |
|
558 | + if ($addUsers) |
|
559 | 559 | { |
560 | 560 | foreach ($group->users as $user) { |
561 | - if (empty($users[$user->uuid])) { |
|
562 | - $users[$user->uuid] = $user; |
|
561 | + if (empty($users[ $user->uuid ])) { |
|
562 | + $users[ $user->uuid ] = $user; |
|
563 | 563 | } |
564 | 564 | } |
565 | 565 | } |
@@ -572,15 +572,15 @@ discard block |
||
572 | 572 | } |
573 | 573 | |
574 | 574 | foreach ($groups as $uuid => $group) { |
575 | - $allowedUserUuids[] = [ |
|
575 | + $allowedUserUuids[ ] = [ |
|
576 | 576 | 'uuid' => $group->uuid, |
577 | 577 | 'recordLabel' => $group->recordLabel |
578 | 578 | ]; |
579 | 579 | } |
580 | 580 | |
581 | 581 | foreach ($users as $uuid => $user) { |
582 | - if($user->getKey() != $this->getKey()) { |
|
583 | - $allowedUserUuids[] = [ |
|
582 | + if ($user->getKey() != $this->getKey()) { |
|
583 | + $allowedUserUuids[ ] = [ |
|
584 | 584 | 'uuid' => $user->uuid, |
585 | 585 | 'recordLabel' => $user->recordLabel |
586 | 586 | ]; |
@@ -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 | /** |
@@ -56,15 +56,15 @@ |
||
56 | 56 | |
57 | 57 | protected static function getModuleFromClass($className) |
58 | 58 | { |
59 | - $modules = Cache::rememberForever('modules_by_model_class', function () { |
|
59 | + $modules = Cache::rememberForever('modules_by_model_class', function() { |
|
60 | 60 | $modulesGroupedByModelClass = collect(); |
61 | - Module::all()->map(function ($item) use ($modulesGroupedByModelClass) { |
|
62 | - $modulesGroupedByModelClass[$item->model_class] = $item; |
|
61 | + Module::all()->map(function($item) use ($modulesGroupedByModelClass) { |
|
62 | + $modulesGroupedByModelClass[ $item->model_class ] = $item; |
|
63 | 63 | return $modulesGroupedByModelClass; |
64 | 64 | }); |
65 | 65 | return $modulesGroupedByModelClass; |
66 | 66 | }); |
67 | - return $modules[(string) $className] ?? null; |
|
67 | + return $modules[ (string)$className ] ?? null; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public function getUuidAttribute() |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | ->get(); |
52 | 52 | |
53 | 53 | // Order by |
54 | - $filterOrderBy = (array) $selectedFilter->order; |
|
54 | + $filterOrderBy = (array)$selectedFilter->order; |
|
55 | 55 | |
56 | 56 | return $this->autoView(compact('datatableColumns', 'filters', 'selectedFilter', 'filterOrderBy')); |
57 | 57 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | if ($relatedList && $relatedList->method) { |
114 | 114 | // Related list method |
115 | 115 | $method = $relatedList->method; |
116 | - $recordIdsMethod = $method . 'RecordIds'; |
|
116 | + $recordIdsMethod = $method.'RecordIds'; |
|
117 | 117 | |
118 | 118 | // Get related records ids |
119 | 119 | $model = new $modelClass; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | // Add the record id itself to be filtered |
123 | 123 | if ($relatedList->module_id === $relatedList->related_module_id && !empty($recordId) && !$filteredRecordIds->contains($recordId)) { |
124 | - $filteredRecordIds[] = (int)$recordId; |
|
124 | + $filteredRecordIds[ ] = (int)$recordId; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | // Make the quer |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $records = $query->paginate($length); |
133 | 133 | } |
134 | 134 | |
135 | - $records->getCollection()->transform(function ($record) use ($domain, $module) { |
|
135 | + $records->getCollection()->transform(function($record) use ($domain, $module) { |
|
136 | 136 | foreach ($module->fields as $field) { |
137 | 137 | // If a special template exists, use it. Else use the generic template |
138 | 138 | $uitype = uitype($field->uitype_id); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $results = collect(); |
177 | 177 | if (method_exists($modelClass, 'getSearchResult') && property_exists($modelClass, 'searchableColumns')) { |
178 | 178 | $searchResults = new Search(); |
179 | - $searchResults->registerModel($modelClass, (array) (new $modelClass)->searchableColumns); |
|
179 | + $searchResults->registerModel($modelClass, (array)(new $modelClass)->searchableColumns); |
|
180 | 180 | $results = $searchResults->search($q)->take(config('uccello.max_results.autocomplete', 10)); |
181 | 181 | } |
182 | 182 | |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | $savePageLength = $request->input('save_page_length'); |
198 | 198 | |
199 | 199 | // Optional data |
200 | - $data = []; |
|
200 | + $data = [ ]; |
|
201 | 201 | if ($savePageLength) { |
202 | - $data["length"] = $request->input('page_length'); |
|
202 | + $data[ "length" ] = $request->input('page_length'); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $filter = Filter::firstOrNew([ |
@@ -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); |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | |
21 | 21 | $rootDomains = app('uccello')->getRootDomains(); |
22 | 22 | |
23 | - $domains = []; |
|
23 | + $domains = [ ]; |
|
24 | 24 | foreach ($rootDomains as $_domain) { |
25 | 25 | $formattedDomain = $this->getFormattedDomainToAdd($domain, $_domain); |
26 | 26 | if ($formattedDomain) { |
27 | - $domains[] = $formattedDomain; |
|
27 | + $domains[ ] = $formattedDomain; |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | |
46 | 46 | $parentDomain = Domain::find(request('id')); |
47 | 47 | |
48 | - $domains = []; |
|
48 | + $domains = [ ]; |
|
49 | 49 | if ($parentDomain) { |
50 | 50 | foreach ($parentDomain->children()->orderBy('name')->get() as $_domain) { |
51 | 51 | $formattedDomain = $this->getFormattedDomainToAdd($domain, $_domain); |
52 | 52 | if ($formattedDomain) { |
53 | - $domains[] = $formattedDomain; |
|
53 | + $domains[ ] = $formattedDomain; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |