We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('account_details', function (Blueprint $table) { |
|
| 16 | + Schema::create('account_details', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->integer('user_id')->unsigned(); |
| 19 | 19 | $table->string('nickname'); |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | return collect($this->fields()) |
| 61 | 61 | ->where('model') |
| 62 | 62 | ->whereIn('relation_type', $relation_types) |
| 63 | - ->filter(function ($item) { |
|
| 63 | + ->filter(function($item) { |
|
| 64 | 64 | return Str::contains($item['entity'], '.') && $item['model'] !== get_class($this->model->{Arr::first(explode('.', $item['entity']))}()->getRelated()) ? false : true; |
| 65 | 65 | }) |
| 66 | 66 | ->toArray(); |
@@ -348,7 +348,7 @@ |
||
| 348 | 348 | if (! is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) { |
| 349 | 349 | //we add the new values into the relation |
| 350 | 350 | $model_instance->whereIn($model_instance->getKeyName(), $relation_values) |
| 351 | - ->update([$relation->getForeignKeyName() => $item->{$relation->getLocalKeyName()}]); |
|
| 351 | + ->update([$relation->getForeignKeyName() => $item->{$relation->getLocalKeyName()}]); |
|
| 352 | 352 | |
| 353 | 353 | //we clear up any values that were removed from model relation. |
| 354 | 354 | //if developer provided a fallback id, we use it |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | $all_relation_fields = $this->getRelationFields(); |
| 93 | 93 | |
| 94 | - return Arr::where($all_relation_fields, function ($value, $key) { |
|
| 94 | + return Arr::where($all_relation_fields, function($value, $key) { |
|
| 95 | 95 | return isset($value['pivot']) && $value['pivot']; |
| 96 | 96 | }); |
| 97 | 97 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $field_data = json_decode($data[$field['name']], true); |
| 151 | 151 | |
| 152 | 152 | //we grab from the parsed data the specific values for this pivot |
| 153 | - $pivot_data = Arr::first(Arr::where($field_data, function ($item) use ($pivot_id, $field) { |
|
| 153 | + $pivot_data = Arr::first(Arr::where($field_data, function($item) use ($pivot_id, $field) { |
|
| 154 | 154 | return $item[$field['name']] === $pivot_id; |
| 155 | 155 | })); |
| 156 | 156 | |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | private function createRelationsForItem($item, $formattedData) |
| 196 | 196 | { |
| 197 | - if (! isset($formattedData['relations'])) { |
|
| 197 | + if (!isset($formattedData['relations'])) { |
|
| 198 | 198 | return false; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | foreach ($formattedData['relations'] as $relationMethod => $relationData) { |
| 202 | - if (! isset($relationData['model'])) { |
|
| 202 | + if (!isset($relationData['model'])) { |
|
| 203 | 203 | continue; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -207,14 +207,14 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | if ($relation instanceof HasOne || $relation instanceof MorphOne) { |
| 209 | 209 | if (isset($relationData['relations'])) { |
| 210 | - $belongsToRelations = Arr::where($relationData['relations'], function ($relation_data) { |
|
| 210 | + $belongsToRelations = Arr::where($relationData['relations'], function($relation_data) { |
|
| 211 | 211 | return $relation_data['relation_type'] == 'BelongsTo'; |
| 212 | 212 | }); |
| 213 | 213 | // adds the values of the BelongsTo relations of this entity to the array of values that will |
| 214 | 214 | // be saved at the same time like we do in parent entity belongs to relations |
| 215 | 215 | $valuesWithRelations = $this->associateHasOneBelongsTo($belongsToRelations, $relationData['values'], $relation->getModel()); |
| 216 | 216 | |
| 217 | - $relationData['relations'] = Arr::where($relationData['relations'], function ($item) { |
|
| 217 | + $relationData['relations'] = Arr::where($relationData['relations'], function($item) { |
|
| 218 | 218 | return $item['relation_type'] != 'BelongsTo'; |
| 219 | 219 | }); |
| 220 | 220 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | private function getRelationDataFromFormData($data) |
| 274 | 274 | { |
| 275 | 275 | // exclude the already attached belongs to relations but include nested belongs to. |
| 276 | - $relation_fields = Arr::where($this->getRelationFields(), function ($field, $key) { |
|
| 276 | + $relation_fields = Arr::where($this->getRelationFields(), function($field, $key) { |
|
| 277 | 277 | return $field['relation_type'] !== 'BelongsTo' || $this->isNestedRelation($field); |
| 278 | 278 | }); |
| 279 | 279 | |
@@ -284,10 +284,10 @@ discard block |
||
| 284 | 284 | if (isset($relation_field['pivot']) && $relation_field['pivot'] !== true) { |
| 285 | 285 | $key = implode('.relations.', explode('.', $this->getOnlyRelationEntity($relation_field))); |
| 286 | 286 | $fieldData = Arr::get($relationData, 'relations.'.$key, []); |
| 287 | - if (! array_key_exists('model', $fieldData)) { |
|
| 287 | + if (!array_key_exists('model', $fieldData)) { |
|
| 288 | 288 | $fieldData['model'] = $relation_field['model']; |
| 289 | 289 | } |
| 290 | - if (! array_key_exists('parent', $fieldData)) { |
|
| 290 | + if (!array_key_exists('parent', $fieldData)) { |
|
| 291 | 291 | $fieldData['parent'] = $this->getRelationModel($attributeKey, -1); |
| 292 | 292 | } |
| 293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | $fieldData['force_delete'] = $relation_field['force_delete'] ?? false; |
| 299 | 299 | |
| 300 | - if (! array_key_exists('relation_type', $fieldData)) { |
|
| 300 | + if (!array_key_exists('relation_type', $fieldData)) { |
|
| 301 | 301 | $fieldData['relation_type'] = $relation_field['relation_type']; |
| 302 | 302 | } |
| 303 | 303 | $relatedAttribute = Arr::last(explode('.', $attributeKey)); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | $related_method = Arr::last($entity_array); |
| 320 | 320 | |
| 321 | - if (! method_exists($relation_model, $related_method)) { |
|
| 321 | + if (!method_exists($relation_model, $related_method)) { |
|
| 322 | 322 | if (count($entity_array) <= 1) { |
| 323 | 323 | return $relation_field['entity']; |
| 324 | 324 | } else { |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | $relation_column_is_nullable = $model_instance->isColumnNullable($relation->getForeignKeyName()); |
| 347 | 347 | |
| 348 | - if (! is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) { |
|
| 348 | + if (!is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) { |
|
| 349 | 349 | //we add the new values into the relation |
| 350 | 350 | $model_instance->whereIn($model_instance->getKeyName(), $relation_values) |
| 351 | 351 | ->update([$relation->getForeignKeyName() => $item->{$relation->getLocalKeyName()}]); |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | ->where($relation->getForeignKeyName(), $item->{$relation->getLocalKeyName()}) |
| 360 | 360 | ->update([$relation->getForeignKeyName() => $relationData['fallback_id']]); |
| 361 | 361 | } else { |
| 362 | - if (! $relation_column_is_nullable || $force_delete) { |
|
| 362 | + if (!$relation_column_is_nullable || $force_delete) { |
|
| 363 | 363 | $model_instance->whereNotIn($model_instance->getKeyName(), $relation_values) |
| 364 | 364 | ->where($relation->getForeignKeyName(), $item->{$relation->getLocalKeyName()}) |
| 365 | 365 | ->delete(); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | $model_instance->where($relation->getForeignKeyName(), $item->{$relation->getLocalKeyName()}) |
| 377 | 377 | ->update([$relation->getForeignKeyName() => $relationData['fallback_id']]); |
| 378 | 378 | } else { |
| 379 | - if (! $relation_column_is_nullable || $force_delete) { |
|
| 379 | + if (!$relation_column_is_nullable || $force_delete) { |
|
| 380 | 380 | $model_instance->where($relation->getForeignKeyName(), $item->{$relation->getLocalKeyName()})->delete(); |
| 381 | 381 | } else { |
| 382 | 382 | $model_instance->where($relation->getForeignKeyName(), $item->{$relation->getLocalKeyName()}) |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | if ($items->isEmpty()) { |
| 403 | 403 | $entry->{$relationMethod}()->sync([]); |
| 404 | 404 | } else { |
| 405 | - $items->each(function (&$item, $key) use ($relatedModel, $entry, $relationMethod) { |
|
| 405 | + $items->each(function(&$item, $key) use ($relatedModel, $entry, $relationMethod) { |
|
| 406 | 406 | if (isset($item[$relatedModel->getKeyName()])) { |
| 407 | 407 | $entry->{$relationMethod}()->updateOrCreate([$relatedModel->getKeyName() => $item[$relatedModel->getKeyName()]], $item); |
| 408 | 408 | } else { |
@@ -412,11 +412,11 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | $relatedItemsSent = $items->pluck($relatedModel->getKeyName()); |
| 414 | 414 | |
| 415 | - if (! $relatedItemsSent->isEmpty()) { |
|
| 415 | + if (!$relatedItemsSent->isEmpty()) { |
|
| 416 | 416 | $itemsInDatabase = $entry->{$relationMethod}; |
| 417 | 417 | //we perform the cleanup of removed database items |
| 418 | - $itemsInDatabase->each(function ($item, $key) use ($relatedItemsSent) { |
|
| 419 | - if (! $relatedItemsSent->contains($item->getKey())) { |
|
| 418 | + $itemsInDatabase->each(function($item, $key) use ($relatedItemsSent) { |
|
| 419 | + if (!$relatedItemsSent->contains($item->getKey())) { |
|
| 420 | 420 | $item->delete(); |
| 421 | 421 | } |
| 422 | 422 | }); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | foreach ($fields as &$field) { |
| 62 | 62 | // set the value |
| 63 | - if (! isset($field['value'])) { |
|
| 63 | + if (!isset($field['value'])) { |
|
| 64 | 64 | if (isset($field['subfields'])) { |
| 65 | 65 | $field['value'] = []; |
| 66 | 66 | foreach ($field['subfields'] as $subfield) { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // always have a hidden input for the entry id |
| 76 | - if (! array_key_exists('id', $fields)) { |
|
| 76 | + if (!array_key_exists('id', $fields)) { |
|
| 77 | 77 | $fields['id'] = [ |
| 78 | 78 | 'name' => $entry->getKeyName(), |
| 79 | 79 | 'value' => $entry->getKey(), |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $relation_array = explode('.', $relational_entity); |
| 101 | 101 | |
| 102 | - $relatedModel = $relatedModel = array_reduce(array_splice($relation_array, 0, -1), function ($obj, $method) { |
|
| 102 | + $relatedModel = $relatedModel = array_reduce(array_splice($relation_array, 0, -1), function($obj, $method) { |
|
| 103 | 103 | return $obj->{$method} ? $obj->{$method} : $obj; |
| 104 | 104 | }, $model); |
| 105 | 105 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | if ($relation instanceof HasMany || $relation instanceof MorphMany) { |
| 114 | 114 | if (isset($field['pivotFields']) && is_array($field['pivotFields'])) { |
| 115 | - $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) { |
|
| 115 | + $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) { |
|
| 116 | 116 | return $field['name'] != $item['name']; |
| 117 | 117 | }); |
| 118 | 118 | $related_models = $relatedModel->{$relationMethod}; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | if (isset($field['pivot']) && $field['pivot'] && isset($field['pivotFields']) && is_array($field['pivotFields'])) { |
| 139 | 139 | |
| 140 | 140 | // we remove our current relation from the pivotFields. |
| 141 | - $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) { |
|
| 141 | + $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) { |
|
| 142 | 142 | return $field['name'] != $item['name']; |
| 143 | 143 | }); |
| 144 | 144 | |