@@ -154,7 +154,7 @@ |
||
154 | 154 | |
155 | 155 | // Add tab id if defined |
156 | 156 | if ($this->tab_id) { |
157 | - $params['tab'] = $this->tab_id; |
|
157 | + $params[ 'tab' ] = $this->tab_id; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return ucroute('uccello.edit.relation.delete', $domain, $this->relatedModule, $params); |
@@ -60,17 +60,17 @@ |
||
60 | 60 | |
61 | 61 | public function parentGroups() |
62 | 62 | { |
63 | - return $this->belongsToMany(self::class, $this->tablePrefix . 'rl_groups_groups', 'children_id', 'parent_id'); |
|
63 | + return $this->belongsToMany(self::class, $this->tablePrefix.'rl_groups_groups', 'children_id', 'parent_id'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | public function childrenGroups() |
67 | 67 | { |
68 | - return $this->belongsToMany(self::class, $this->tablePrefix . 'rl_groups_groups', 'parent_id', 'children_id'); |
|
68 | + return $this->belongsToMany(self::class, $this->tablePrefix.'rl_groups_groups', 'parent_id', 'children_id'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | public function users() |
72 | 72 | { |
73 | - return $this->belongsToMany(User::class, $this->tablePrefix . 'rl_groups_users'); |
|
73 | + return $this->belongsToMany(User::class, $this->tablePrefix.'rl_groups_users'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -24,11 +24,11 @@ |
||
24 | 24 | 'record_id', |
25 | 25 | ]; |
26 | 26 | |
27 | - protected $primaryKey = 'id'; // TODO: Change to "uid" to make joins withs modules tables possible ??? |
|
27 | + protected $primaryKey = 'id'; // TODO: Change to "uid" to make joins withs modules tables possible ??? |
|
28 | 28 | public $incrementing = false; |
29 | 29 | |
30 | 30 | // Allow Eloquent to return id as string instead of int. |
31 | - protected $casts = ['id' => 'string']; |
|
31 | + protected $casts = [ 'id' => 'string' ]; |
|
32 | 32 | |
33 | 33 | protected function initTablePrefix() |
34 | 34 | { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | parent::boot(); |
21 | 21 | |
22 | - if(static::isFilteredByUser()) |
|
22 | + if (static::isFilteredByUser()) |
|
23 | 23 | { |
24 | 24 | static::addGlobalScope(new AssignedUser); |
25 | 25 | } |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | { |
30 | 30 | $user = Auth::user(); |
31 | 31 | |
32 | - if($user && !$user->is_admin) |
|
32 | + if ($user && !$user->is_admin) |
|
33 | 33 | { |
34 | 34 | $module = static::getModuleFromClass(static::class); |
35 | 35 | |
36 | - if($module && $module->data && property_exists($module->data, 'private') && $module->data->private) |
|
36 | + if ($module && $module->data && property_exists($module->data, 'private') && $module->data->private) |
|
37 | 37 | { |
38 | 38 | return true; |
39 | 39 | } |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | |
55 | 55 | protected static function getModuleFromClass($className) |
56 | 56 | { |
57 | - $modules = Cache::rememberForever('modules_by_model_class', function () { |
|
57 | + $modules = Cache::rememberForever('modules_by_model_class', function() { |
|
58 | 58 | $modulesGroupedByModelClass = collect(); |
59 | - Module::all()->map(function ($item) use ($modulesGroupedByModelClass) { |
|
60 | - $modulesGroupedByModelClass[$item->model_class] = $item; |
|
59 | + Module::all()->map(function($item) use ($modulesGroupedByModelClass) { |
|
60 | + $modulesGroupedByModelClass[ $item->model_class ] = $item; |
|
61 | 61 | return $modulesGroupedByModelClass; |
62 | 62 | }); |
63 | 63 | return $modulesGroupedByModelClass; |
64 | 64 | }); |
65 | - return $modules[(string) $className] ?? null; |
|
65 | + return $modules[ (string)$className ] ?? null; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | public function getUidAttribute() |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ->where('record_id', $this->getKey()) |
74 | 74 | ->first(); |
75 | 75 | |
76 | - if($entity) |
|
76 | + if ($entity) |
|
77 | 77 | { |
78 | 78 | $uid = $entity->getKey(); |
79 | 79 | } |
@@ -274,15 +274,15 @@ |
||
274 | 274 | |
275 | 275 | // Redirect to source record if a relation was deleted |
276 | 276 | if (isset($relatedlist) && $request->input('id')) { |
277 | - $params = ['id' => $request->input('id')]; |
|
277 | + $params = [ 'id' => $request->input('id') ]; |
|
278 | 278 | |
279 | 279 | // Add tab id if defined to select it automaticaly |
280 | 280 | if ($request->input('tab')) { |
281 | - $params['tab'] = $request->input('tab'); |
|
281 | + $params[ 'tab' ] = $request->input('tab'); |
|
282 | 282 | } |
283 | 283 | // Add related list id to select the related tab automaticaly |
284 | 284 | else { |
285 | - $params['relatedlist'] = $relatedlist->id; |
|
285 | + $params[ 'relatedlist' ] = $relatedlist->id; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | $route = ucroute('uccello.detail', $domain, $relatedlist->module, $params); |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | public function down() |
45 | 45 | { |
46 | 46 | // Drop table |
47 | - Schema::dropIfExists($this->tablePrefix . 'uccello_groups'); |
|
48 | - Schema::dropIfExists($this->tablePrefix . 'uccello_rl_groups_groups'); |
|
49 | - Schema::dropIfExists($this->tablePrefix . 'uccello_rl_groups_users'); |
|
47 | + Schema::dropIfExists($this->tablePrefix.'uccello_groups'); |
|
48 | + Schema::dropIfExists($this->tablePrefix.'uccello_rl_groups_groups'); |
|
49 | + Schema::dropIfExists($this->tablePrefix.'uccello_rl_groups_users'); |
|
50 | 50 | |
51 | 51 | // Delete module |
52 | 52 | Module::where('name', 'group')->forceDelete(); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | protected function createTables() |
56 | 56 | { |
57 | 57 | // Module Table |
58 | - Schema::create($this->tablePrefix . 'uccello_groups', function (Blueprint $table) { |
|
58 | + Schema::create($this->tablePrefix.'uccello_groups', function(Blueprint $table) { |
|
59 | 59 | $table->increments('id'); |
60 | 60 | $table->string('name')->nullable(); |
61 | 61 | $table->text('description')->nullable(); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | }); |
67 | 67 | |
68 | 68 | // Related List Table: Groups-Groups |
69 | - Schema::create($this->tablePrefix . 'uccello_rl_groups_groups', function (Blueprint $table) { |
|
69 | + Schema::create($this->tablePrefix.'uccello_rl_groups_groups', function(Blueprint $table) { |
|
70 | 70 | $table->increments('id'); |
71 | 71 | $table->unsignedInteger('parent_id'); |
72 | 72 | $table->unsignedInteger('children_id'); |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | |
75 | 75 | // Foreign keys |
76 | 76 | $table->foreign('parent_id') |
77 | - ->references('id')->on($this->tablePrefix . 'uccello_groups') |
|
77 | + ->references('id')->on($this->tablePrefix.'uccello_groups') |
|
78 | 78 | ->onDelete('cascade'); |
79 | 79 | |
80 | 80 | $table->foreign('children_id') |
81 | - ->references('id')->on($this->tablePrefix . 'uccello_groups') |
|
81 | + ->references('id')->on($this->tablePrefix.'uccello_groups') |
|
82 | 82 | ->onDelete('cascade'); |
83 | 83 | |
84 | 84 | // Unique keys |
85 | - $table->unique(['parent_id', 'children_id']); |
|
85 | + $table->unique([ 'parent_id', 'children_id' ]); |
|
86 | 86 | }); |
87 | 87 | |
88 | 88 | // Related List Table: Groups-Users |
89 | - Schema::create($this->tablePrefix . 'uccello_rl_groups_users', function (Blueprint $table) { |
|
89 | + Schema::create($this->tablePrefix.'uccello_rl_groups_users', function(Blueprint $table) { |
|
90 | 90 | $table->increments('id'); |
91 | 91 | $table->unsignedInteger('group_id'); |
92 | 92 | $table->unsignedInteger('user_id'); |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | |
95 | 95 | // Foreign keys |
96 | 96 | $table->foreign('group_id') |
97 | - ->references('id')->on($this->tablePrefix . 'uccello_groups') |
|
97 | + ->references('id')->on($this->tablePrefix.'uccello_groups') |
|
98 | 98 | ->onDelete('cascade'); |
99 | 99 | |
100 | 100 | $table->foreign('user_id') |
101 | - ->references('id')->on($this->tablePrefix . 'users') |
|
101 | + ->references('id')->on($this->tablePrefix.'users') |
|
102 | 102 | ->onDelete('cascade'); |
103 | 103 | |
104 | 104 | // Unique keys |
105 | - $table->unique(['group_id', 'user_id']); |
|
105 | + $table->unique([ 'group_id', 'user_id' ]); |
|
106 | 106 | }); |
107 | 107 | } |
108 | 108 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $filter->user_id = null; |
169 | 169 | $filter->name = 'filter.all'; |
170 | 170 | $filter->type = 'list'; |
171 | - $filter->columns = [ 'name', 'description']; |
|
171 | + $filter->columns = [ 'name', 'description' ]; |
|
172 | 172 | $filter->conditions = null; |
173 | 173 | $filter->order_by = null; |
174 | 174 | $filter->is_default = true; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | 'method' => 'getRelatedList', |
201 | 201 | 'data' => [ |
202 | 202 | "relationName" => "childrenGroups", |
203 | - "actions" => ["select", "add"] |
|
203 | + "actions" => [ "select", "add" ] |
|
204 | 204 | ], |
205 | 205 | 'sequence' => 0 |
206 | 206 | ]); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 'label' => 'relatedlist.users', |
218 | 218 | 'type' => 'n-n', |
219 | 219 | 'method' => 'getRelatedList', |
220 | - 'data' => ["actions" => ["select", "add"]], |
|
220 | + 'data' => [ "actions" => [ "select", "add" ] ], |
|
221 | 221 | 'sequence' => 0 |
222 | 222 | ]); |
223 | 223 | } |
@@ -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 | ); |
@@ -494,13 +494,13 @@ discard block |
||
494 | 494 | if ($this->is_admin) { |
495 | 495 | $groups = Group::orderBy('name')->get(); |
496 | 496 | } else { |
497 | - $allowedUserUids[] = $this->uid; |
|
497 | + $allowedUserUids[ ] = $this->uid; |
|
498 | 498 | |
499 | - $groups = []; |
|
500 | - $users = []; |
|
499 | + $groups = [ ]; |
|
500 | + $users = [ ]; |
|
501 | 501 | |
502 | 502 | foreach ($this->groups as $group) { |
503 | - $groups[$group->uid] = $group; |
|
503 | + $groups[ $group->uid ] = $group; |
|
504 | 504 | }; |
505 | 505 | |
506 | 506 | $this->addRecursiveChildrenGroups($groups, $users, $groups, false); |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | } |
510 | 510 | |
511 | 511 | foreach ($groups as $uid => $group) { |
512 | - $allowedUserUids[] = $uid; |
|
512 | + $allowedUserUids[ ] = $uid; |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | return $allowedUserUids; |
@@ -518,19 +518,19 @@ discard block |
||
518 | 518 | protected function addRecursiveChildrenGroups(&$groups, &$users, $searchGroups, $addUsers = false) |
519 | 519 | { |
520 | 520 | foreach ($searchGroups as $uid => $searchGroup) { |
521 | - $searchChildrenGroups = []; |
|
521 | + $searchChildrenGroups = [ ]; |
|
522 | 522 | |
523 | 523 | foreach ($searchGroup->childrenGroups as $childrenGroup) { |
524 | - if (empty($groups[$childrenGroup->uid])) { |
|
525 | - $groups[$childrenGroup->uid] = $childrenGroup; |
|
526 | - $searchChildrenGroups[$childrenGroup->uid] = $childrenGroup; |
|
524 | + if (empty($groups[ $childrenGroup->uid ])) { |
|
525 | + $groups[ $childrenGroup->uid ] = $childrenGroup; |
|
526 | + $searchChildrenGroups[ $childrenGroup->uid ] = $childrenGroup; |
|
527 | 527 | } |
528 | 528 | |
529 | - if($addUsers) |
|
529 | + if ($addUsers) |
|
530 | 530 | { |
531 | 531 | foreach ($childrenGroup->users as $user) { |
532 | - if (empty($users[$user->uid])) { |
|
533 | - $users[$user->uid] = $user; |
|
532 | + if (empty($users[ $user->uid ])) { |
|
533 | + $users[ $user->uid ] = $user; |
|
534 | 534 | } |
535 | 535 | } |
536 | 536 | } |
@@ -548,22 +548,22 @@ discard block |
||
548 | 548 | $groups = Group::orderBy('name')->get(); |
549 | 549 | $users = \App\User::orderBy('name')->get(); |
550 | 550 | } else { |
551 | - $allowedUserUids[] = [ |
|
551 | + $allowedUserUids[ ] = [ |
|
552 | 552 | 'uid' => $this->uid, |
553 | 553 | 'recordLabel' => $this->recordLabel |
554 | 554 | ]; |
555 | 555 | |
556 | - $groups = []; |
|
557 | - $users = []; |
|
556 | + $groups = [ ]; |
|
557 | + $users = [ ]; |
|
558 | 558 | |
559 | 559 | foreach ($this->groups as $group) { |
560 | - $groups[$group->uid] = $group; |
|
560 | + $groups[ $group->uid ] = $group; |
|
561 | 561 | |
562 | - if($addUsers) |
|
562 | + if ($addUsers) |
|
563 | 563 | { |
564 | 564 | foreach ($group->users as $user) { |
565 | - if (empty($users[$user->uid])) { |
|
566 | - $users[$user->uid] = $user; |
|
565 | + if (empty($users[ $user->uid ])) { |
|
566 | + $users[ $user->uid ] = $user; |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | } |
@@ -576,15 +576,15 @@ discard block |
||
576 | 576 | } |
577 | 577 | |
578 | 578 | foreach ($groups as $uid => $group) { |
579 | - $allowedUserUids[] = [ |
|
579 | + $allowedUserUids[ ] = [ |
|
580 | 580 | 'uid' => $group->uid, |
581 | 581 | 'recordLabel' => $group->recordLabel |
582 | 582 | ]; |
583 | 583 | } |
584 | 584 | |
585 | 585 | foreach ($users as $uid => $user) { |
586 | - if($user->getKey() != $this->getKey()) { |
|
587 | - $allowedUserUids[] = [ |
|
586 | + if ($user->getKey() != $this->getKey()) { |
|
587 | + $allowedUserUids[ ] = [ |
|
588 | 588 | 'uid' => $user->uid, |
589 | 589 | 'recordLabel' => $user->recordLabel |
590 | 590 | ]; |
@@ -234,26 +234,26 @@ discard block |
||
234 | 234 | |
235 | 235 | if (is_numeric($nameOrId)) { |
236 | 236 | // Use cache |
237 | - $modules = Cache::rememberForever('modules_by_id', function () { |
|
237 | + $modules = Cache::rememberForever('modules_by_id', function() { |
|
238 | 238 | $modulesGroupedById = collect(); |
239 | 239 | Module::all()->map(function($item) use($modulesGroupedById) { |
240 | - $modulesGroupedById[$item->id] = $item; |
|
240 | + $modulesGroupedById[ $item->id ] = $item; |
|
241 | 241 | return $modulesGroupedById; |
242 | 242 | }); |
243 | 243 | return $modulesGroupedById; |
244 | 244 | }); |
245 | - return $modules[(string) $nameOrId] ?? null; |
|
245 | + return $modules[ (string)$nameOrId ] ?? null; |
|
246 | 246 | } else { |
247 | 247 | // Use cache |
248 | - $modules = Cache::rememberForever('modules_by_name', function () { |
|
248 | + $modules = Cache::rememberForever('modules_by_name', function() { |
|
249 | 249 | $modulesGroupedByName = collect(); |
250 | 250 | Module::all()->map(function($item) use($modulesGroupedByName) { |
251 | - $modulesGroupedByName[$item->name] = $item; |
|
251 | + $modulesGroupedByName[ $item->name ] = $item; |
|
252 | 252 | return $modulesGroupedByName; |
253 | 253 | }); |
254 | 254 | return $modulesGroupedByName; |
255 | 255 | }); |
256 | - return $modules[(string) $nameOrId] ?? null; |
|
256 | + return $modules[ (string)$nameOrId ] ?? null; |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
@@ -271,26 +271,26 @@ discard block |
||
271 | 271 | |
272 | 272 | if (is_numeric($nameOrId)) { |
273 | 273 | // Use cache |
274 | - $uitypes = Cache::rememberForever('uitypes_by_id', function () { |
|
274 | + $uitypes = Cache::rememberForever('uitypes_by_id', function() { |
|
275 | 275 | $uitypesGroupedById = collect(); |
276 | 276 | Uitype::all()->map(function($item) use($uitypesGroupedById) { |
277 | - $uitypesGroupedById[$item->id] = $item; |
|
277 | + $uitypesGroupedById[ $item->id ] = $item; |
|
278 | 278 | return $uitypesGroupedById; |
279 | 279 | }); |
280 | 280 | return $uitypesGroupedById; |
281 | 281 | }); |
282 | - return $uitypes[(string) $nameOrId] ?? null; |
|
282 | + return $uitypes[ (string)$nameOrId ] ?? null; |
|
283 | 283 | } else { |
284 | 284 | // Use cache |
285 | - $uitypes = Cache::rememberForever('uitypes_by_name', function () { |
|
285 | + $uitypes = Cache::rememberForever('uitypes_by_name', function() { |
|
286 | 286 | $uitypesGroupedByName = collect(); |
287 | 287 | Uitype::all()->map(function($item) use($uitypesGroupedByName) { |
288 | - $uitypesGroupedByName[$item->name] = $item; |
|
288 | + $uitypesGroupedByName[ $item->name ] = $item; |
|
289 | 289 | return $uitypesGroupedByName; |
290 | 290 | }); |
291 | 291 | return $uitypesGroupedByName; |
292 | 292 | }); |
293 | - return $uitypes[(string) $nameOrId] ?? null; |
|
293 | + return $uitypes[ (string)$nameOrId ] ?? null; |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
@@ -308,26 +308,26 @@ discard block |
||
308 | 308 | |
309 | 309 | if (is_numeric($nameOrId)) { |
310 | 310 | // Use cache |
311 | - $displaytypes = Cache::rememberForever('displaytypes_by_id', function () { |
|
311 | + $displaytypes = Cache::rememberForever('displaytypes_by_id', function() { |
|
312 | 312 | $displaytypesGroupedById = collect(); |
313 | 313 | Displaytype::all()->map(function($item) use($displaytypesGroupedById) { |
314 | - $displaytypesGroupedById[$item->id] = $item; |
|
314 | + $displaytypesGroupedById[ $item->id ] = $item; |
|
315 | 315 | return $displaytypesGroupedById; |
316 | 316 | }); |
317 | 317 | return $displaytypesGroupedById; |
318 | 318 | }); |
319 | - return $displaytypes[(string) $nameOrId] ?? null; |
|
319 | + return $displaytypes[ (string)$nameOrId ] ?? null; |
|
320 | 320 | } else { |
321 | 321 | // Use cache |
322 | - $displaytypes = Cache::rememberForever('displaytypes_by_name', function () { |
|
322 | + $displaytypes = Cache::rememberForever('displaytypes_by_name', function() { |
|
323 | 323 | $displaytypesGroupedByName = collect(); |
324 | 324 | Displaytype::all()->map(function($item) use($displaytypesGroupedByName) { |
325 | - $displaytypesGroupedByName[$item->name] = $item; |
|
325 | + $displaytypesGroupedByName[ $item->name ] = $item; |
|
326 | 326 | return $displaytypesGroupedByName; |
327 | 327 | }); |
328 | 328 | return $displaytypesGroupedByName; |
329 | 329 | }); |
330 | - return $displaytypes[(string) $nameOrId] ?? null; |
|
330 | + return $displaytypes[ (string)$nameOrId ] ?? null; |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -345,26 +345,26 @@ discard block |
||
345 | 345 | |
346 | 346 | if (is_numeric($nameOrId)) { |
347 | 347 | // Use cache |
348 | - $capabilities = Cache::rememberForever('capabilities_by_id', function () { |
|
348 | + $capabilities = Cache::rememberForever('capabilities_by_id', function() { |
|
349 | 349 | $capabilitiesGroupedById = collect(); |
350 | 350 | Capability::all()->map(function($item) use($capabilitiesGroupedById) { |
351 | - $capabilitiesGroupedById[$item->id] = $item; |
|
351 | + $capabilitiesGroupedById[ $item->id ] = $item; |
|
352 | 352 | return $capabilitiesGroupedById; |
353 | 353 | }); |
354 | 354 | return $capabilitiesGroupedById; |
355 | 355 | }); |
356 | - return $capabilities[(string) $nameOrId] ?? null; |
|
356 | + return $capabilities[ (string)$nameOrId ] ?? null; |
|
357 | 357 | } else { |
358 | 358 | // Use cache |
359 | - $capabilities = Cache::rememberForever('capabilities_by_name', function () { |
|
359 | + $capabilities = Cache::rememberForever('capabilities_by_name', function() { |
|
360 | 360 | $capabilitiesGroupedByName = collect(); |
361 | 361 | Capability::all()->map(function($item) use($capabilitiesGroupedByName) { |
362 | - $capabilitiesGroupedByName[$item->name] = $item; |
|
362 | + $capabilitiesGroupedByName[ $item->name ] = $item; |
|
363 | 363 | return $capabilitiesGroupedByName; |
364 | 364 | }); |
365 | 365 | return $capabilitiesGroupedByName; |
366 | 366 | }); |
367 | - return $capabilities[(string) $nameOrId] ?? null; |
|
367 | + return $capabilities[ (string)$nameOrId ] ?? null; |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * @param string $type |
407 | 407 | * @return array |
408 | 408 | */ |
409 | - public function getDatatableColumns(Module $module, $filterId=null, $type='list'): array |
|
409 | + public function getDatatableColumns(Module $module, $filterId = null, $type = 'list'): array |
|
410 | 410 | { |
411 | 411 | $columns = [ ]; |
412 | 412 | |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | { |
493 | 493 | $entity = Entity::find($uid); |
494 | 494 | |
495 | - if($entity) { |
|
495 | + if ($entity) { |
|
496 | 496 | return $entity->record; |
497 | 497 | } |
498 | 498 | else { |
@@ -109,8 +109,8 @@ |
||
109 | 109 | */ |
110 | 110 | public function addConditionToSearchQuery(Builder $query, Field $field, $value) : Builder |
111 | 111 | { |
112 | - $query->where(function ($query) use($field, $value) { |
|
113 | - foreach ((array) $value as $_value) { |
|
112 | + $query->where(function($query) use($field, $value) { |
|
113 | + foreach ((array)$value as $_value) { |
|
114 | 114 | // Replace me by connected user's id |
115 | 115 | if ($_value === 'me') { |
116 | 116 | $_value = Auth::user()->uid; |