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'); |
@@ -385,7 +385,7 @@ |
||
| 385 | 385 | if (! is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) { |
| 386 | 386 | //we add the new values into the relation |
| 387 | 387 | $model_instance->whereIn($model_instance->getKeyName(), $relation_values) |
| 388 | - ->update([$relation_foreign_key => $item->{$relation_local_key}]); |
|
| 388 | + ->update([$relation_foreign_key => $item->{$relation_local_key}]); |
|
| 389 | 389 | |
| 390 | 390 | //we clear up any values that were removed from model relation. |
| 391 | 391 | //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 | |
@@ -211,14 +211,14 @@ discard block |
||
| 211 | 211 | case MorphOne::class: |
| 212 | 212 | // we first check if there are relations of the relation |
| 213 | 213 | if (isset($relationData['relations'])) { |
| 214 | - $belongsToRelations = Arr::where($relationData['relations'], function ($relation_data) { |
|
| 214 | + $belongsToRelations = Arr::where($relationData['relations'], function($relation_data) { |
|
| 215 | 215 | return $relation_data['relation_type'] == 'BelongsTo'; |
| 216 | 216 | }); |
| 217 | 217 | // adds the values of the BelongsTo relations of this entity to the array of values that will |
| 218 | 218 | // be saved at the same time like we do in parent entity belongs to relations |
| 219 | 219 | $valuesWithRelations = $this->associateHasOneBelongsTo($belongsToRelations, $relationData['values'], $relation->getModel()); |
| 220 | 220 | |
| 221 | - $relationData['relations'] = Arr::where($relationData['relations'], function ($item) { |
|
| 221 | + $relationData['relations'] = Arr::where($relationData['relations'], function($item) { |
|
| 222 | 222 | return $item['relation_type'] != 'BelongsTo'; |
| 223 | 223 | }); |
| 224 | 224 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | private function getRelationDataFromFormData($data) |
| 313 | 313 | { |
| 314 | 314 | // exclude the already attached belongs to relations but include nested belongs to. |
| 315 | - $relation_fields = Arr::where($this->getRelationFields(), function ($field, $key) { |
|
| 315 | + $relation_fields = Arr::where($this->getRelationFields(), function($field, $key) { |
|
| 316 | 316 | return $field['relation_type'] !== 'BelongsTo' || $this->isNestedRelation($field); |
| 317 | 317 | }); |
| 318 | 318 | |
@@ -323,10 +323,10 @@ discard block |
||
| 323 | 323 | if (isset($relation_field['pivot']) && $relation_field['pivot'] !== true) { |
| 324 | 324 | $key = implode('.relations.', explode('.', $this->getOnlyRelationEntity($relation_field))); |
| 325 | 325 | $fieldData = Arr::get($relationData, 'relations.'.$key, []); |
| 326 | - if (! array_key_exists('model', $fieldData)) { |
|
| 326 | + if (!array_key_exists('model', $fieldData)) { |
|
| 327 | 327 | $fieldData['model'] = $relation_field['model']; |
| 328 | 328 | } |
| 329 | - if (! array_key_exists('parent', $fieldData)) { |
|
| 329 | + if (!array_key_exists('parent', $fieldData)) { |
|
| 330 | 330 | $fieldData['parent'] = $this->getRelationModel($attributeKey, -1); |
| 331 | 331 | } |
| 332 | 332 | |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | // this allow developers to override that behavior and force deletion from database |
| 341 | 341 | $fieldData['force_delete'] = $relation_field['force_delete'] ?? false; |
| 342 | 342 | |
| 343 | - if (! array_key_exists('relation_type', $fieldData)) { |
|
| 343 | + if (!array_key_exists('relation_type', $fieldData)) { |
|
| 344 | 344 | $fieldData['relation_type'] = $relation_field['relation_type']; |
| 345 | 345 | } |
| 346 | 346 | $relatedAttribute = Arr::last(explode('.', $attributeKey)); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | $relation_column_is_nullable = $model_instance->isColumnNullable($relation_foreign_key); |
| 371 | 371 | |
| 372 | - if (! is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) { |
|
| 372 | + if (!is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) { |
|
| 373 | 373 | //we add the new values into the relation |
| 374 | 374 | $model_instance->whereIn($model_instance->getKeyName(), $relation_values) |
| 375 | 375 | ->update([$relation_foreign_key => $item->{$relation_local_key}]); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | ->where($relation_foreign_key, $item->{$relation_local_key}) |
| 384 | 384 | ->update([$relation_foreign_key => $relationData['fallback_id']]); |
| 385 | 385 | } else { |
| 386 | - if (! $relation_column_is_nullable || $force_delete) { |
|
| 386 | + if (!$relation_column_is_nullable || $force_delete) { |
|
| 387 | 387 | $model_instance->whereNotIn($model_instance->getKeyName(), $relation_values) |
| 388 | 388 | ->where($relation_foreign_key, $item->{$relation_local_key}) |
| 389 | 389 | ->delete(); |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | $model_instance->where($relation_foreign_key, $item->{$relation_local_key}) |
| 401 | 401 | ->update([$relation_foreign_key => $relationData['fallback_id']]); |
| 402 | 402 | } else { |
| 403 | - if (! $relation_column_is_nullable || $force_delete) { |
|
| 403 | + if (!$relation_column_is_nullable || $force_delete) { |
|
| 404 | 404 | $model_instance->where($relation_foreign_key, $item->{$relation_local_key})->delete(); |
| 405 | 405 | } else { |
| 406 | 406 | $model_instance->where($relation_foreign_key, $item->{$relation_local_key}) |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | if ($items->isEmpty()) { |
| 426 | 426 | $entry->{$relationMethod}()->sync([]); |
| 427 | 427 | } else { |
| 428 | - $items->each(function (&$item, $key) use ($relatedModel, $entry, $relationMethod) { |
|
| 428 | + $items->each(function(&$item, $key) use ($relatedModel, $entry, $relationMethod) { |
|
| 429 | 429 | if (isset($item[$relatedModel->getKeyName()])) { |
| 430 | 430 | $entry->{$relationMethod}()->updateOrCreate([$relatedModel->getKeyName() => $item[$relatedModel->getKeyName()]], $item); |
| 431 | 431 | } else { |
@@ -435,10 +435,10 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | $relatedItemsSent = $items->pluck($relatedModel->getKeyName()); |
| 437 | 437 | |
| 438 | - if (! $relatedItemsSent->isEmpty()) { |
|
| 438 | + if (!$relatedItemsSent->isEmpty()) { |
|
| 439 | 439 | //we perform the cleanup of removed database items |
| 440 | - $entry->{$relationMethod}->each(function ($item, $key) use ($relatedItemsSent) { |
|
| 441 | - if (! $relatedItemsSent->contains($item->getKey())) { |
|
| 440 | + $entry->{$relationMethod}->each(function($item, $key) use ($relatedItemsSent) { |
|
| 441 | + if (!$relatedItemsSent->contains($item->getKey())) { |
|
| 442 | 442 | $item->delete(); |
| 443 | 443 | } |
| 444 | 444 | }); |
@@ -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 = array_reduce(array_splice($relation_array, 0, -1), function ($obj, $method) { |
|
| 102 | + $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 | |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | private function getManyRelationAttributeValue($model, $relation_method, $field) |
| 163 | 163 | { |
| 164 | - if (! isset($field['pivotFields']) || ! is_array($field['pivotFields'])) { |
|
| 164 | + if (!isset($field['pivotFields']) || !is_array($field['pivotFields'])) { |
|
| 165 | 165 | return false; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) { |
|
| 168 | + $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) { |
|
| 169 | 169 | return $field['name'] != $item['name']; |
| 170 | 170 | }); |
| 171 | 171 | $related_models = $model->{$relation_method}; |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | private function getToManyRelationAttributeValue($model, $relation_method, $field) |
| 197 | 197 | { |
| 198 | 198 | // if pivot is true and there are `pivotFields` we need to get those pivot values to show on the edit page |
| 199 | - if (! isset($field['pivot']) || ! isset($field['pivotFields']) || ! is_array($field['pivotFields'])) { |
|
| 199 | + if (!isset($field['pivot']) || !isset($field['pivotFields']) || !is_array($field['pivotFields'])) { |
|
| 200 | 200 | return false; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | // we remove our current relation from the pivotFields. |
| 204 | - $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) { |
|
| 204 | + $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) { |
|
| 205 | 205 | return $field['name'] != $item['name']; |
| 206 | 206 | }); |
| 207 | 207 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | return collect($this->fields()) |
| 62 | 62 | ->where('model') |
| 63 | 63 | ->whereIn('relation_type', $relation_types) |
| 64 | - ->filter(function ($item) { |
|
| 64 | + ->filter(function($item) { |
|
| 65 | 65 | $related_model = get_class($this->model->{Arr::first(explode('.', $item['entity']))}()->getRelated()); |
| 66 | 66 | |
| 67 | 67 | return Str::contains($item['entity'], '.') && $item['model'] !== $related_model ? false : true; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $related_method = Arr::last($entity_array); |
| 215 | 215 | |
| 216 | - if (! method_exists($relation_model, $related_method)) { |
|
| 216 | + if (!method_exists($relation_model, $related_method)) { |
|
| 217 | 217 | if (count($entity_array) <= 1) { |
| 218 | 218 | return $relation_field['entity']; |
| 219 | 219 | } else { |