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; |
@@ -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 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | private function getRelationDataFromFormData($data) |
290 | 290 | { |
291 | 291 | // exclude the already attached belongs to relations but include nested belongs to. |
292 | - $relation_fields = Arr::where($this->getRelationFields(), function ($field, $key) { |
|
292 | + $relation_fields = Arr::where($this->getRelationFields(), function($field, $key) { |
|
293 | 293 | return $field['relation_type'] !== 'BelongsTo' || $this->isNestedRelation($field); |
294 | 294 | }); |
295 | 295 | |
@@ -300,10 +300,10 @@ discard block |
||
300 | 300 | if (isset($relation_field['pivot']) && $relation_field['pivot'] !== true) { |
301 | 301 | $key = implode('.relations.', explode('.', $this->getOnlyRelationEntity($relation_field))); |
302 | 302 | $fieldData = Arr::get($relationData, 'relations.'.$key, []); |
303 | - if (! array_key_exists('model', $fieldData)) { |
|
303 | + if (!array_key_exists('model', $fieldData)) { |
|
304 | 304 | $fieldData['model'] = $relation_field['model']; |
305 | 305 | } |
306 | - if (! array_key_exists('parent', $fieldData)) { |
|
306 | + if (!array_key_exists('parent', $fieldData)) { |
|
307 | 307 | $fieldData['parent'] = $this->getRelationModel($attributeKey, -1); |
308 | 308 | } |
309 | 309 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | // this allow developers to override that behavior and force deletion from database |
318 | 318 | $fieldData['force_delete'] = $relation_field['force_delete'] ?? false; |
319 | 319 | |
320 | - if (! array_key_exists('relation_type', $fieldData)) { |
|
320 | + if (!array_key_exists('relation_type', $fieldData)) { |
|
321 | 321 | $fieldData['relation_type'] = $relation_field['relation_type']; |
322 | 322 | } |
323 | 323 | $relatedAttribute = Arr::last(explode('.', $attributeKey)); |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | |
346 | 346 | $related_method = Arr::last($entity_array); |
347 | 347 | |
348 | - if (! method_exists($relation_model, $related_method)) { |
|
348 | + if (!method_exists($relation_model, $related_method)) { |
|
349 | 349 | if (count($entity_array) <= 1) { |
350 | 350 | return $relation_field['entity']; |
351 | 351 | } else { |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | $relation_column_is_nullable = $model_instance->isColumnNullable($relation_foreign_key); |
376 | 376 | |
377 | - if (! is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) { |
|
377 | + if (!is_null($relation_values) && $relationData['values'][$relationMethod][0] !== null) { |
|
378 | 378 | //we add the new values into the relation |
379 | 379 | $model_instance->whereIn($model_instance->getKeyName(), $relation_values) |
380 | 380 | ->update([$relation_foreign_key => $item->{$relation_local_key}]); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | ->where($relation_foreign_key, $item->{$relation_local_key}) |
389 | 389 | ->update([$relation_foreign_key => $relationData['fallback_id']]); |
390 | 390 | } else { |
391 | - if (! $relation_column_is_nullable || $force_delete) { |
|
391 | + if (!$relation_column_is_nullable || $force_delete) { |
|
392 | 392 | $model_instance->whereNotIn($model_instance->getKeyName(), $relation_values) |
393 | 393 | ->where($relation_foreign_key, $item->{$relation_local_key}) |
394 | 394 | ->delete(); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $model_instance->where($relation_foreign_key, $item->{$relation_local_key}) |
406 | 406 | ->update([$relation_foreign_key => $relationData['fallback_id']]); |
407 | 407 | } else { |
408 | - if (! $relation_column_is_nullable || $force_delete) { |
|
408 | + if (!$relation_column_is_nullable || $force_delete) { |
|
409 | 409 | $model_instance->where($relation_foreign_key, $item->{$relation_local_key})->delete(); |
410 | 410 | } else { |
411 | 411 | $model_instance->where($relation_foreign_key, $item->{$relation_local_key}) |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | if ($items->isEmpty()) { |
432 | 432 | $entry->{$relationMethod}()->sync([]); |
433 | 433 | } else { |
434 | - $items->each(function (&$item, $key) use ($relatedModel, $entry, $relationMethod) { |
|
434 | + $items->each(function(&$item, $key) use ($relatedModel, $entry, $relationMethod) { |
|
435 | 435 | if (isset($item[$relatedModel->getKeyName()])) { |
436 | 436 | $entry->{$relationMethod}()->updateOrCreate([$relatedModel->getKeyName() => $item[$relatedModel->getKeyName()]], $item); |
437 | 437 | } else { |
@@ -441,10 +441,10 @@ discard block |
||
441 | 441 | |
442 | 442 | $relatedItemsSent = $items->pluck($relatedModel->getKeyName()); |
443 | 443 | |
444 | - if (! $relatedItemsSent->isEmpty()) { |
|
444 | + if (!$relatedItemsSent->isEmpty()) { |
|
445 | 445 | //we perform the cleanup of removed database items |
446 | - $entry->{$relationMethod}->each(function ($item, $key) use ($relatedItemsSent) { |
|
447 | - if (! $relatedItemsSent->contains($item->getKey())) { |
|
446 | + $entry->{$relationMethod}->each(function($item, $key) use ($relatedItemsSent) { |
|
447 | + if (!$relatedItemsSent->contains($item->getKey())) { |
|
448 | 448 | $item->delete(); |
449 | 449 | } |
450 | 450 | }); |
@@ -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 |