We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | // here we are going to iterate through all relation parts to check |
| 25 | 25 | foreach ($parts as $i => $part) { |
| 26 | 26 | $relation = $model->$part(); |
| 27 | - if (! is_a($relation, \Illuminate\Database\Eloquent\Relations\Relation::class, true)) { |
|
| 27 | + if (!is_a($relation, \Illuminate\Database\Eloquent\Relations\Relation::class, true)) { |
|
| 28 | 28 | return $model; |
| 29 | 29 | } |
| 30 | 30 | $model = $relation->getRelated(); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $model = new ($this->getRelationModel($entity, -1)); |
| 69 | 69 | $lastSegmentAfterDot = Str::of($field['entity'])->afterLast('.')->value(); |
| 70 | 70 | |
| 71 | - if (! $this->modelMethodIsRelationship($model, $lastSegmentAfterDot)) { |
|
| 71 | + if (!$this->modelMethodIsRelationship($model, $lastSegmentAfterDot)) { |
|
| 72 | 72 | return (string) Str::of($field['entity'])->beforeLast('.'); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | return collect($this->getCleanStateFields()) |
| 91 | 91 | ->whereIn('relation_type', $relation_types) |
| 92 | - ->filter(function ($item) use ($nested) { |
|
| 92 | + ->filter(function($item) use ($nested) { |
|
| 93 | 93 | if ($nested) { |
| 94 | 94 | return true; |
| 95 | 95 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | private function getRelationFieldsWithoutRelationType($relations, $fields = []) |
| 135 | 135 | { |
| 136 | - if (! is_array($relations)) { |
|
| 136 | + if (!is_array($relations)) { |
|
| 137 | 137 | $relations = [$relations]; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | foreach ($relations as $relation) { |
| 145 | - $fields = array_filter($fields, function ($field) use ($relation) { |
|
| 146 | - if (! isset($field['relation_type'])) { |
|
| 145 | + $fields = array_filter($fields, function($field) use ($relation) { |
|
| 146 | + if (!isset($field['relation_type'])) { |
|
| 147 | 147 | return false; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $fields = array_merge($field['subfields'], $fields); |
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | - $fields = array_filter($fields, function ($field) { |
|
| 180 | + $fields = array_filter($fields, function($field) { |
|
| 181 | 181 | return isset($field['relation_type']) && $field['relation_type'] === 'BelongsTo'; |
| 182 | 182 | }); |
| 183 | 183 | } |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | { |
| 245 | 245 | $all_relation_fields = $this->getRelationFields(); |
| 246 | 246 | |
| 247 | - return Arr::where($all_relation_fields, function ($value, $key) { |
|
| 248 | - return isset($value['pivot']) && ! $value['pivot']; |
|
| 247 | + return Arr::where($all_relation_fields, function($value, $key) { |
|
| 248 | + return isset($value['pivot']) && !$value['pivot']; |
|
| 249 | 249 | }); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | $all_relation_fields = $this->getRelationFields(); |
| 260 | 260 | |
| 261 | - return Arr::where($all_relation_fields, function ($value, $key) { |
|
| 261 | + return Arr::where($all_relation_fields, function($value, $key) { |
|
| 262 | 262 | return isset($value['pivot']) && $value['pivot']; |
| 263 | 263 | }); |
| 264 | 264 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | private function modelMethodIsRelationship($model, $method) |
| 330 | 330 | { |
| 331 | - if (! method_exists($model, $method)) { |
|
| 331 | + if (!method_exists($model, $method)) { |
|
| 332 | 332 | if ($model->isRelation($method)) { |
| 333 | 333 | return $method; |
| 334 | 334 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | // relationships are always public methods. |
| 347 | - if (! $methodReflection->isPublic()) { |
|
| 347 | + if (!$methodReflection->isPublic()) { |
|
| 348 | 348 | return false; |
| 349 | 349 | } |
| 350 | 350 | |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | */ |
| 372 | 372 | public function isAttributeInRelationString(array $field): bool |
| 373 | 373 | { |
| 374 | - if (! str_contains($field['entity'], '.')) { |
|
| 374 | + if (!str_contains($field['entity'], '.')) { |
|
| 375 | 375 | return false; |
| 376 | 376 | } |
| 377 | 377 | |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | try { |
| 388 | 388 | $model = $model->$part(); |
| 389 | 389 | |
| 390 | - if (! is_a($model, \Illuminate\Database\Eloquent\Relations\Relation::class, true)) { |
|
| 390 | + if (!is_a($model, \Illuminate\Database\Eloquent\Relations\Relation::class, true)) { |
|
| 391 | 391 | return true; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | //all items with relation |
| 21 | 21 | $dependencies = $primary_dependency['model']::with($primary_dependency['entity_secondary']); |
| 22 | 22 | |
| 23 | - if(isset($primary_dependency['options']) && $primary_dependency['options'] instanceof \Closure){ |
|
| 23 | + if (isset($primary_dependency['options']) && $primary_dependency['options'] instanceof \Closure) { |
|
| 24 | 24 | $dependencies = $primary_dependency['options']($dependencies); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $primaryDependencyOptionQuery = $primary_dependency['model']::query(); |
| 78 | 78 | |
| 79 | - if(isset($primary_dependency['options']) && $primary_dependency['options'] instanceof \Closure){ |
|
| 79 | + if (isset($primary_dependency['options']) && $primary_dependency['options'] instanceof \Closure) { |
|
| 80 | 80 | $primaryDependencyOptionQuery = $primary_dependency['options']($primaryDependencyOptionQuery); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $secondaryDependencyOptionQuery = $secondary_dependency['model']::query(); |
| 86 | 86 | |
| 87 | - if(isset($secondary_dependency['options']) && $secondary_dependency['options'] instanceof \Closure){ |
|
| 87 | + if (isset($secondary_dependency['options']) && $secondary_dependency['options'] instanceof \Closure) { |
|
| 88 | 88 | $secondaryDependencyOptionQuery = $secondary_dependency['options']($secondaryDependencyOptionQuery); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $this->crud->set('reorder.enabled', true); |
| 37 | 37 | $this->crud->allowAccess('reorder'); |
| 38 | 38 | |
| 39 | - $this->crud->operation('reorder', function () { |
|
| 39 | + $this->crud->operation('reorder', function() { |
|
| 40 | 40 | $this->crud->loadDefaultOperationSettingsFromConfig(); |
| 41 | 41 | $this->crud->setOperationSetting('reorderColumnNames', [ |
| 42 | 42 | 'parent_id' => 'parent_id', |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | ]); |
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | - $this->crud->operation('list', function () { |
|
| 49 | + $this->crud->operation('list', function() { |
|
| 50 | 50 | $this->crud->addButton('top', 'reorder', 'view', 'crud::buttons.reorder'); |
| 51 | 51 | }); |
| 52 | 52 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $this->crud->hasAccessOrFail('reorder'); |
| 64 | 64 | |
| 65 | - if (! $this->crud->isReorderEnabled()) { |
|
| 65 | + if (!$this->crud->isReorderEnabled()) { |
|
| 66 | 66 | abort(403, 'Reorder is disabled.'); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | @section('content') |
| 29 | 29 | <?php |
| 30 | -if(!function_exists('tree_element')) { |
|
| 30 | +if (!function_exists('tree_element')) { |
|
| 31 | 31 | function tree_element($entry, $key, $all_entries, $crud) { |
| 32 | 32 | $columns = $crud->getOperationSetting('reorderColumnNames'); |
| 33 | 33 | |
| 34 | - if (! isset($entry->tree_element_shown)) { |
|
| 34 | + if (!isset($entry->tree_element_shown)) { |
|
| 35 | 35 | // mark the element as shown |
| 36 | 36 | $all_entries[$key]->tree_element_shown = true; |
| 37 | 37 | $entry->tree_element_shown = true; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | <ol class="sortable mt-0 mb-0"> |
| 76 | 76 | <?php |
| 77 | 77 | $all_entries = collect($entries->all())->sortBy($columns['lft'])->keyBy($crud->getModel()->getKeyName()); |
| 78 | - $root_entries = $all_entries->filter(function ($item) use ($columns) { |
|
| 78 | + $root_entries = $all_entries->filter(function($item) use ($columns) { |
|
| 79 | 79 | return $item->{$columns['parent_id']} == 0; |
| 80 | 80 | }); |
| 81 | 81 | foreach ($root_entries as $key => $entry) { |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | $itemKeys = $this->model->query()->select($primaryKey)->get()->pluck($primaryKey); |
| 29 | 29 | |
| 30 | 30 | // filter the items that are not in the database and map the request |
| 31 | - $reorderItems = collect($request)->filter(function ($item) use ($itemKeys) { |
|
| 31 | + $reorderItems = collect($request)->filter(function($item) use ($itemKeys) { |
|
| 32 | 32 | return $item['item_id'] !== '' && $item['item_id'] !== null && $itemKeys->contains($item['item_id']); |
| 33 | - })->map(function ($item) use ($primaryKey, $columns) { |
|
| 33 | + })->map(function($item) use ($primaryKey, $columns) { |
|
| 34 | 34 | $item[$primaryKey] = $item['item_id']; |
| 35 | 35 | $item[$columns['parent_id']] = empty($item['parent_id']) ? null : $item['parent_id']; |
| 36 | 36 | $item[$columns['depth']] = empty($item['depth']) ? null : (int) $item['depth']; |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $sentIds = array_column($reorderItems, $primaryKey); |
| 61 | 61 | |
| 62 | - $itemKeys = $itemKeys->filter(function ($id) use ($sentIds) { |
|
| 62 | + $itemKeys = $itemKeys->filter(function($id) use ($sentIds) { |
|
| 63 | 63 | return in_array($id, $sentIds); |
| 64 | 64 | }); |
| 65 | 65 | |
| 66 | 66 | // wrap the queries in a transaction to avoid partial updates |
| 67 | - DB::connection($this->model->getConnectionName())->transaction(function () use ($reorderItems, $primaryKey, $itemKeys, $columns) { |
|
| 67 | + DB::connection($this->model->getConnectionName())->transaction(function() use ($reorderItems, $primaryKey, $itemKeys, $columns) { |
|
| 68 | 68 | // create a string of ?,?,?,? to use as bind placeholders for item keys |
| 69 | 69 | $reorderItemsBindString = implode(',', array_fill(0, count($reorderItems), '?')); |
| 70 | 70 | |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | { |
| 614 | 614 | $this->crudPanel->setOperationSetting( |
| 615 | 615 | 'strippedRequest', |
| 616 | - static function (Request $request) { |
|
| 616 | + static function(Request $request) { |
|
| 617 | 617 | return $request->toArray(); |
| 618 | 618 | }, |
| 619 | 619 | 'update' |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | ->validationMessages(['required' => 'is_required', 'min' => 'min_2']) |
| 749 | 749 | ->store_in('some') |
| 750 | 750 | ->size(6) |
| 751 | - ->on('created', function () { |
|
| 751 | + ->on('created', function() { |
|
| 752 | 752 | }) |
| 753 | 753 | ->subfields([['name' => 'sub_1']]) |
| 754 | 754 | ->entity('bang'); |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | 'class' => 'form-group col-md-6 mb-3', |
| 781 | 781 | ], |
| 782 | 782 | 'events' => [ |
| 783 | - 'created' => function () { |
|
| 783 | + 'created' => function() { |
|
| 784 | 784 | }, |
| 785 | 785 | ], |
| 786 | 786 | 'subfields' => [ |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | |
| 983 | 983 | public function testItCanInferFieldAttributesFromADynamicRelation() |
| 984 | 984 | { |
| 985 | - User::resolveRelationUsing('dynamicRelation', function ($user) { |
|
| 985 | + User::resolveRelationUsing('dynamicRelation', function($user) { |
|
| 986 | 986 | return $user->hasOne(\Backpack\CRUD\Tests\config\Models\AccountDetails::class); |
| 987 | 987 | }); |
| 988 | 988 | |