@@ -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->getAllowedGroupUidsProcess(); |
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 getAllowedGroupUidsProcess() |
491 | 491 | { |
492 | - $allowedUserUids = collect([$this->uid]); |
|
492 | + $allowedUserUids = collect([ $this->uid ]); |
|
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->uid] = $group; |
|
501 | + $groups[ $group->uid ] = $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 $uid => $group) { |
510 | - $allowedUserUids[] = $uid; |
|
510 | + $allowedUserUids[ ] = $uid; |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | return $allowedUserUids; |
@@ -516,19 +516,19 @@ discard block |
||
516 | 516 | protected function addRecursiveChildrenGroups(&$groups, &$users, $searchGroups, $addUsers = false) |
517 | 517 | { |
518 | 518 | foreach ($searchGroups as $uid => $searchGroup) { |
519 | - $searchChildrenGroups = []; |
|
519 | + $searchChildrenGroups = [ ]; |
|
520 | 520 | |
521 | 521 | foreach ($searchGroup->childrenGroups as $childrenGroup) { |
522 | - if (empty($groups[$childrenGroup->uid])) { |
|
523 | - $groups[$childrenGroup->uid] = $childrenGroup; |
|
524 | - $searchChildrenGroups[$childrenGroup->uid] = $childrenGroup; |
|
522 | + if (empty($groups[ $childrenGroup->uid ])) { |
|
523 | + $groups[ $childrenGroup->uid ] = $childrenGroup; |
|
524 | + $searchChildrenGroups[ $childrenGroup->uid ] = $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->uid])) { |
|
531 | - $users[$user->uid] = $user; |
|
530 | + if (empty($users[ $user->uid ])) { |
|
531 | + $users[ $user->uid ] = $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 | - $allowedUserUids = collect([[ |
|
543 | + $allowedUserUids = collect([ [ |
|
544 | 544 | 'uid' => $this->uid, |
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->uid] = $group; |
|
556 | + $groups[ $group->uid ] = $group; |
|
557 | 557 | |
558 | - if($addUsers) |
|
558 | + if ($addUsers) |
|
559 | 559 | { |
560 | 560 | foreach ($group->users as $user) { |
561 | - if (empty($users[$user->uid])) { |
|
562 | - $users[$user->uid] = $user; |
|
561 | + if (empty($users[ $user->uid ])) { |
|
562 | + $users[ $user->uid ] = $user; |
|
563 | 563 | } |
564 | 564 | } |
565 | 565 | } |
@@ -572,15 +572,15 @@ discard block |
||
572 | 572 | } |
573 | 573 | |
574 | 574 | foreach ($groups as $uid => $group) { |
575 | - $allowedUserUids[] = [ |
|
575 | + $allowedUserUids[ ] = [ |
|
576 | 576 | 'uid' => $group->uid, |
577 | 577 | 'recordLabel' => $group->recordLabel |
578 | 578 | ]; |
579 | 579 | } |
580 | 580 | |
581 | 581 | foreach ($users as $uid => $user) { |
582 | - if($user->getKey() != $this->getKey()) { |
|
583 | - $allowedUserUids[] = [ |
|
582 | + if ($user->getKey() != $this->getKey()) { |
|
583 | + $allowedUserUids[ ] = [ |
|
584 | 584 | 'uid' => $user->uid, |
585 | 585 | 'recordLabel' => $user->recordLabel |
586 | 586 | ]; |