@@ -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 | ]; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | ]; |
| 46 | 46 | |
| 47 | 47 | // We want the field displays the date in the good format |
| 48 | - $options['value'] = $this->getFormattedValueToDisplay($field, $record); |
|
| 48 | + $options[ 'value' ] = $this->getFormattedValueToDisplay($field, $record); |
|
| 49 | 49 | |
| 50 | 50 | return $options; |
| 51 | 51 | } |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | public function addConditionToSearchQuery(Builder $query, Field $field, $value) : Builder |
| 111 | 111 | { |
| 112 | 112 | if (!$this->isEmptyOrNotEmptySearchQuery($query, $field, $value)) { |
| 113 | - $query->where(function ($query) use($field, $value) { |
|
| 113 | + $query->where(function($query) use($field, $value) { |
|
| 114 | 114 | if (strpos($value, ',') > -1) { |
| 115 | 115 | $values = explode(',', $value); // Start Date, End Date |
| 116 | - $dateStart = \Carbon\Carbon::createFromFormat(config('uccello.format.php.date'), trim($values[0])); |
|
| 117 | - $dateEnd = \Carbon\Carbon::createFromFormat(config('uccello.format.php.date'), trim($values[1])); |
|
| 116 | + $dateStart = \Carbon\Carbon::createFromFormat(config('uccello.format.php.date'), trim($values[ 0 ])); |
|
| 117 | + $dateEnd = \Carbon\Carbon::createFromFormat(config('uccello.format.php.date'), trim($values[ 1 ])); |
|
| 118 | 118 | } else { |
| 119 | 119 | switch ($value) { |
| 120 | 120 | // Today |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | protected function isEmptyOrNotEmptySearchQuery(Builder &$query, Field $field, $value): bool |
| 124 | 124 | { |
| 125 | 125 | if ($value === uctrans('filter.search_flag.empty', $field->module)) { |
| 126 | - $query->where(function ($q) use ($field) { |
|
| 126 | + $query->where(function($q) use ($field) { |
|
| 127 | 127 | $q->whereNull($field->column) |
| 128 | 128 | ->orWhere($field->column, '=', ''); |
| 129 | 129 | }); |
@@ -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 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $field = $module->fields->where('name', $fieldName)->first(); |
| 440 | 440 | |
| 441 | 441 | // If the field does not exist or is not listable, continue |
| 442 | - if (!$field || !$field->isListable() || in_array($fieldName, $fieldsAdded)) { |
|
| 442 | + if (!$field || !$field->isListable() || in_array($fieldName, $fieldsAdded)) { |
|
| 443 | 443 | continue; |
| 444 | 444 | } |
| 445 | 445 | |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | * @param string $type |
| 491 | 491 | * @return Filter |
| 492 | 492 | */ |
| 493 | - public function getDefaultFilter(Module $module, $type="list") |
|
| 493 | + public function getDefaultFilter(Module $module, $type = "list") |
|
| 494 | 494 | { |
| 495 | 495 | $filter = Filter::where('module_id', $module->id) |
| 496 | 496 | ->where('type', $type) |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | }); |
| 54 | 54 | |
| 55 | 55 | $validator = Validator::make(request()->all(), [ |
| 56 | - 'username' => $rules['username'], |
|
| 57 | - 'name' => $rules['name'], |
|
| 58 | - 'email' => $rules['email'], |
|
| 56 | + 'username' => $rules[ 'username' ], |
|
| 57 | + 'name' => $rules[ 'name' ], |
|
| 58 | + 'email' => $rules[ 'email' ], |
|
| 59 | 59 | ]); |
| 60 | 60 | |
| 61 | 61 | if ($validator->fails()) { |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | if (request('avatar')) { |
| 95 | 95 | $image = str_replace('data:image/png;base64,', '', request('avatar')); |
| 96 | 96 | $image = str_replace(' ', '+', $image); |
| 97 | - $imageName = 'user-' . $user->id . '.png'; |
|
| 97 | + $imageName = 'user-'.$user->id.'.png'; |
|
| 98 | 98 | $path = storage_path('app/public/avatar/'); |
| 99 | - $filepath = $path . $imageName; |
|
| 99 | + $filepath = $path.$imageName; |
|
| 100 | 100 | |
| 101 | - if(!\File::isDirectory($path)){ |
|
| 101 | + if (!\File::isDirectory($path)) { |
|
| 102 | 102 | \File::makeDirectory($path, 0777, true, true); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $field = Field::where('module_id', ucmodule('user')->id)->where('name', 'password')->first(); |
| 131 | 131 | $password_rules = isset($field->data->rules) ? explode('|', $field->data->rules) : ''; |
| 132 | - $password_rules[] = 'confirmed'; |
|
| 132 | + $password_rules[ ] = 'confirmed'; |
|
| 133 | 133 | |
| 134 | 134 | $validator = Validator::make(request()->all(), [ |
| 135 | 135 | 'current_password' => function($attribute, $value, $fail) use ($user) { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $data = $userSettings->data ?? new \stdClass; |
| 174 | 174 | |
| 175 | - foreach ((array) request('settings') as $key => $value) { |
|
| 175 | + foreach ((array)request('settings') as $key => $value) { |
|
| 176 | 176 | if ($value === 'true') { |
| 177 | 177 | $value = true; |
| 178 | 178 | } elseif ($value === 'false') { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | ->get(); |
| 52 | 52 | |
| 53 | 53 | // Order |
| 54 | - $filterOrderBy = (array) $selectedFilter->order; |
|
| 54 | + $filterOrderBy = (array)$selectedFilter->order; |
|
| 55 | 55 | |
| 56 | 56 | // See descendants |
| 57 | 57 | $seeDescendants = request()->session()->get('descendants'); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | if ($relatedList && $relatedList->method) { |
| 121 | 121 | // Related list method |
| 122 | 122 | $method = $relatedList->method; |
| 123 | - $recordIdsMethod = $method . 'RecordIds'; |
|
| 123 | + $recordIdsMethod = $method.'RecordIds'; |
|
| 124 | 124 | |
| 125 | 125 | // Get related records ids |
| 126 | 126 | $model = new $modelClass; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | // Add the record id itself to be filtered |
| 130 | 130 | if ($relatedList->module_id === $relatedList->related_module_id && !empty($recordId) && !$filteredRecordIds->contains($recordId)) { |
| 131 | - $filteredRecordIds[] = (int)$recordId; |
|
| 131 | + $filteredRecordIds[ ] = (int)$recordId; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // Make the quer |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $records = $query->paginate($length); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $records->getCollection()->transform(function ($record) use ($domain, $module) { |
|
| 142 | + $records->getCollection()->transform(function($record) use ($domain, $module) { |
|
| 143 | 143 | foreach ($module->fields as $field) { |
| 144 | 144 | // If a special template exists, use it. Else use the generic template |
| 145 | 145 | $uitype = uitype($field->uitype_id); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $results = collect(); |
| 184 | 184 | if (method_exists($modelClass, 'getSearchResult') && property_exists($modelClass, 'searchableColumns')) { |
| 185 | 185 | $searchResults = new Search(); |
| 186 | - $searchResults->registerModel($modelClass, (array) (new $modelClass)->searchableColumns); |
|
| 186 | + $searchResults->registerModel($modelClass, (array)(new $modelClass)->searchableColumns); |
|
| 187 | 187 | $results = $searchResults->search($q)->take(config('uccello.max_results.autocomplete', 10)); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -204,9 +204,9 @@ discard block |
||
| 204 | 204 | $savePageLength = $request->input('save_page_length'); |
| 205 | 205 | |
| 206 | 206 | // Optional data |
| 207 | - $data = []; |
|
| 207 | + $data = [ ]; |
|
| 208 | 208 | if ($savePageLength) { |
| 209 | - $data["length"] = $request->input('page_length'); |
|
| 209 | + $data[ "length" ] = $request->input('page_length'); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | $filter = Filter::firstOrNew([ |
@@ -19,14 +19,14 @@ discard block |
||
| 19 | 19 | $domain = Domain::firstOrFail(); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - return Cache::rememberForever('domains_root_user_'.auth()->id(), function () use($domain) { |
|
| 22 | + return Cache::rememberForever('domains_root_user_'.auth()->id(), function() use($domain) { |
|
| 23 | 23 | $rootDomains = app('uccello')->getRootDomains(); |
| 24 | 24 | |
| 25 | - $domains = []; |
|
| 25 | + $domains = [ ]; |
|
| 26 | 26 | foreach ($rootDomains as $_domain) { |
| 27 | 27 | $formattedDomain = $this->getFormattedDomainToAdd($domain, $_domain); |
| 28 | 28 | if ($formattedDomain) { |
| 29 | - $domains[] = $formattedDomain; |
|
| 29 | + $domains[ ] = $formattedDomain; |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $parentDomain = Domain::find(request('id')); |
| 50 | 50 | |
| 51 | - return Cache::rememberForever('domains_'.$parentDomain->id.'_children_user_'.auth()->id(), function () use($domain, $parentDomain) { |
|
| 52 | - $domains = []; |
|
| 51 | + return Cache::rememberForever('domains_'.$parentDomain->id.'_children_user_'.auth()->id(), function() use($domain, $parentDomain) { |
|
| 52 | + $domains = [ ]; |
|
| 53 | 53 | if ($parentDomain) { |
| 54 | 54 | foreach ($parentDomain->children()->orderBy('name')->get() as $_domain) { |
| 55 | 55 | $formattedDomain = $this->getFormattedDomainToAdd($domain, $_domain); |
| 56 | 56 | if ($formattedDomain) { |
| 57 | - $domains[] = $formattedDomain; |
|
| 57 | + $domains[ ] = $formattedDomain; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | } |