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'); |
@@ -61,7 +61,7 @@ |
||
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; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | foreach ($fields as &$field) { |
56 | 56 | // set the value |
57 | - if (! isset($field['value'])) { |
|
57 | + if (!isset($field['value'])) { |
|
58 | 58 | if (isset($field['subfields'])) { |
59 | 59 | $field['value'] = []; |
60 | 60 | foreach ($field['subfields'] as $subfield) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | // always have a hidden input for the entry id |
70 | - if (! array_key_exists('id', $fields)) { |
|
70 | + if (!array_key_exists('id', $fields)) { |
|
71 | 71 | $fields['id'] = [ |
72 | 72 | 'name' => $entry->getKeyName(), |
73 | 73 | 'value' => $entry->getKey(), |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $relation_array = explode('.', $relational_entity); |
95 | 95 | |
96 | - $relatedModel = array_reduce(array_splice($relation_array, 0, -1), function ($obj, $method) { |
|
96 | + $relatedModel = array_reduce(array_splice($relation_array, 0, -1), function($obj, $method) { |
|
97 | 97 | return $obj->{$method} ? $obj->{$method} : $obj; |
98 | 98 | }, $model); |
99 | 99 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | case 'HasMany': |
111 | 111 | case 'MorphMany': |
112 | 112 | if (isset($field['pivotFields']) && is_array($field['pivotFields'])) { |
113 | - $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) { |
|
113 | + $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) { |
|
114 | 114 | return $field['name'] != $item['name']; |
115 | 115 | }); |
116 | 116 | $related_models = $relatedModel->{$relationMethod}; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if (isset($field['pivot']) && $field['pivot'] && isset($field['pivotFields']) && is_array($field['pivotFields'])) { |
137 | 137 | |
138 | 138 | // we remove our current relation from the pivotFields. |
139 | - $pivot_fields = Arr::where($field['pivotFields'], function ($item) use ($field) { |
|
139 | + $pivot_fields = Arr::where($field['pivotFields'], function($item) use ($field) { |
|
140 | 140 | return $field['name'] != $item['name']; |
141 | 141 | }); |
142 | 142 |
@@ -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': |
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 | |
@@ -231,14 +231,14 @@ discard block |
||
231 | 231 | |
232 | 232 | if ($relation instanceof HasOne || $relation instanceof MorphOne) { |
233 | 233 | if (isset($relationData['relations'])) { |
234 | - $belongsToRelations = Arr::where($relationData['relations'], function ($relation_data) { |
|
234 | + $belongsToRelations = Arr::where($relationData['relations'], function($relation_data) { |
|
235 | 235 | return $relation_data['relation_type'] == 'BelongsTo'; |
236 | 236 | }); |
237 | 237 | // adds the values of the BelongsTo relations of this entity to the array of values that will |
238 | 238 | // be saved at the same time like we do in parent entity belongs to relations |
239 | 239 | $valuesWithRelations = $this->associateHasOneBelongsTo($belongsToRelations, $relationData['values'], $relation->getModel()); |
240 | 240 | |
241 | - $relationData['relations'] = Arr::where($relationData['relations'], function ($item) { |
|
241 | + $relationData['relations'] = Arr::where($relationData['relations'], function($item) { |
|
242 | 242 | return $item['relation_type'] != 'BelongsTo'; |
243 | 243 | }); |
244 | 244 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | private function getRelationDataFromFormData($data) |
298 | 298 | { |
299 | 299 | // exclude the already attached belongs to relations but include nested belongs to. |
300 | - $relation_fields = Arr::where($this->getRelationFields(), function ($field, $key) { |
|
300 | + $relation_fields = Arr::where($this->getRelationFields(), function($field, $key) { |
|
301 | 301 | return $field['relation_type'] !== 'BelongsTo' || $this->isNestedRelation($field); |
302 | 302 | }); |
303 | 303 | |
@@ -308,10 +308,10 @@ discard block |
||
308 | 308 | if (isset($relation_field['pivot']) && $relation_field['pivot'] !== true) { |
309 | 309 | $key = implode('.relations.', explode('.', $this->getOnlyRelationEntity($relation_field))); |
310 | 310 | $fieldData = Arr::get($relationData, 'relations.'.$key, []); |
311 | - if (! array_key_exists('model', $fieldData)) { |
|
311 | + if (!array_key_exists('model', $fieldData)) { |
|
312 | 312 | $fieldData['model'] = $relation_field['model']; |
313 | 313 | } |
314 | - if (! array_key_exists('parent', $fieldData)) { |
|
314 | + if (!array_key_exists('parent', $fieldData)) { |
|
315 | 315 | $fieldData['parent'] = $this->getRelationModel($attributeKey, -1); |
316 | 316 | } |
317 | 317 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | // this allow developers to override that behavior and force deletion from database |
326 | 326 | $fieldData['force_delete'] = $relation_field['force_delete'] ?? false; |
327 | 327 | |
328 | - if (! array_key_exists('relation_type', $fieldData)) { |
|
328 | + if (!array_key_exists('relation_type', $fieldData)) { |
|
329 | 329 | $fieldData['relation_type'] = $relation_field['relation_type']; |
330 | 330 | } |
331 | 331 | $relatedAttribute = Arr::last(explode('.', $attributeKey)); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | $related_method = Arr::last($entity_array); |
355 | 355 | |
356 | - if (! method_exists($relation_model, $related_method)) { |
|
356 | + if (!method_exists($relation_model, $related_method)) { |
|
357 | 357 | if (count($entity_array) <= 1) { |
358 | 358 | return $relation_field['entity']; |
359 | 359 | } else { |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | $relation_column_is_nullable = $model_instance->isColumnNullable($relation_foreign_key); |
384 | 384 | |
385 | - if (! is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) { |
|
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 | 388 | ->update([$relation_foreign_key => $item->{$relation_local_key}]); |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | ->where($relation_foreign_key, $item->{$relation_local_key}) |
397 | 397 | ->update([$relation_foreign_key => $relationData['fallback_id']]); |
398 | 398 | } else { |
399 | - if (! $relation_column_is_nullable || $force_delete) { |
|
399 | + if (!$relation_column_is_nullable || $force_delete) { |
|
400 | 400 | $model_instance->whereNotIn($model_instance->getKeyName(), $relation_values) |
401 | 401 | ->where($relation_foreign_key, $item->{$relation_local_key}) |
402 | 402 | ->delete(); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $model_instance->where($relation_foreign_key, $item->{$relation_local_key}) |
414 | 414 | ->update([$relation_foreign_key => $relationData['fallback_id']]); |
415 | 415 | } else { |
416 | - if (! $relation_column_is_nullable || $force_delete) { |
|
416 | + if (!$relation_column_is_nullable || $force_delete) { |
|
417 | 417 | $model_instance->where($relation_foreign_key, $item->{$relation_local_key})->delete(); |
418 | 418 | } else { |
419 | 419 | $model_instance->where($relation_foreign_key, $item->{$relation_local_key}) |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | if ($items->isEmpty()) { |
440 | 440 | $entry->{$relationMethod}()->sync([]); |
441 | 441 | } else { |
442 | - $items->each(function (&$item, $key) use ($relatedModel, $entry, $relationMethod) { |
|
442 | + $items->each(function(&$item, $key) use ($relatedModel, $entry, $relationMethod) { |
|
443 | 443 | if (isset($item[$relatedModel->getKeyName()])) { |
444 | 444 | $entry->{$relationMethod}()->updateOrCreate([$relatedModel->getKeyName() => $item[$relatedModel->getKeyName()]], $item); |
445 | 445 | } else { |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | |
450 | 450 | $relatedItemsSent = $items->pluck($relatedModel->getKeyName()); |
451 | 451 | |
452 | - if (! $relatedItemsSent->isEmpty()) { |
|
452 | + if (!$relatedItemsSent->isEmpty()) { |
|
453 | 453 | $itemsInDatabase = $entry->{$relationMethod}; |
454 | 454 | //we perform the cleanup of removed database items |
455 | - $itemsInDatabase->each(function ($item, $key) use ($relatedItemsSent) { |
|
456 | - if (! $relatedItemsSent->contains($item->getKey())) { |
|
455 | + $itemsInDatabase->each(function($item, $key) use ($relatedItemsSent) { |
|
456 | + if (!$relatedItemsSent->contains($item->getKey())) { |
|
457 | 457 | $item->delete(); |
458 | 458 | } |
459 | 459 | }); |