We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -297,7 +297,7 @@ |
||
297 | 297 | |
298 | 298 | // otherwise, loop through all the possible view namespaces |
299 | 299 | // until you find a view that exists |
300 | - $paths = array_map(function ($item) use ($viewPath) { |
|
300 | + $paths = array_map(function($item) use ($viewPath) { |
|
301 | 301 | return $item.'.'.$viewPath; |
302 | 302 | }, config('backpack.crud.view_namespaces.fields')); |
303 | 303 |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function afterField($targetFieldName) |
119 | 119 | { |
120 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
120 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
121 | 121 | return $this->moveField($fields, $targetFieldName, false); |
122 | 122 | }); |
123 | 123 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function beforeField($targetFieldName) |
131 | 131 | { |
132 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
132 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
133 | 133 | return $this->moveField($fields, $targetFieldName, true); |
134 | 134 | }); |
135 | 135 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function makeFirstField() |
143 | 143 | { |
144 | - if (! $this->fields()) { |
|
144 | + if (!$this->fields()) { |
|
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function removeField($name) |
158 | 158 | { |
159 | - $this->transformFields(function ($fields) use ($name) { |
|
159 | + $this->transformFields(function($fields) use ($name) { |
|
160 | 160 | Arr::forget($fields, $name); |
161 | 161 | |
162 | 162 | return $fields; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function removeFields($array_of_names) |
172 | 172 | { |
173 | - if (! empty($array_of_names)) { |
|
173 | + if (!empty($array_of_names)) { |
|
174 | 174 | foreach ($array_of_names as $name) { |
175 | 175 | $this->removeField($name); |
176 | 176 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | public function removeAllFields() |
184 | 184 | { |
185 | 185 | $current_fields = $this->getCleanStateFields(); |
186 | - if (! empty($current_fields)) { |
|
186 | + if (!empty($current_fields)) { |
|
187 | 187 | foreach ($current_fields as $field) { |
188 | 188 | $this->removeField($field['name']); |
189 | 189 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $jsonCastables = ['array', 'object', 'json']; |
281 | 281 | $fieldCasting = $casted_attributes[$field['name']]; |
282 | 282 | |
283 | - if (in_array($fieldCasting, $jsonCastables) && isset($input[$field['name']]) && ! empty($input[$field['name']]) && ! is_array($input[$field['name']])) { |
|
283 | + if (in_array($fieldCasting, $jsonCastables) && isset($input[$field['name']]) && !empty($input[$field['name']]) && !is_array($input[$field['name']])) { |
|
284 | 284 | try { |
285 | 285 | $input[$field['name']] = json_decode($input[$field['name']]); |
286 | 286 | } catch (\Exception $e) { |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function orderFields($order) |
311 | 311 | { |
312 | - $this->transformFields(function ($fields) use ($order) { |
|
312 | + $this->transformFields(function($fields) use ($order) { |
|
313 | 313 | return $this->applyOrderToFields($fields, $order); |
314 | 314 | }); |
315 | 315 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | public function hasUploadFields() |
336 | 336 | { |
337 | 337 | $fields = $this->getCleanStateFields(); |
338 | - $upload_fields = Arr::where($fields, function ($value, $key) { |
|
338 | + $upload_fields = Arr::where($fields, function($value, $key) { |
|
339 | 339 | return isset($value['upload']) && $value['upload'] == true; |
340 | 340 | }); |
341 | 341 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $alreadyLoaded = $this->getLoadedFieldTypes(); |
399 | 399 | $type = $this->getFieldTypeWithNamespace($field); |
400 | 400 | |
401 | - if (! in_array($type, $this->getLoadedFieldTypes(), true)) { |
|
401 | + if (!in_array($type, $this->getLoadedFieldTypes(), true)) { |
|
402 | 402 | $alreadyLoaded[] = $type; |
403 | 403 | $this->setLoadedFieldTypes($alreadyLoaded); |
404 | 404 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | */ |
440 | 440 | public function fieldTypeNotLoaded($field) |
441 | 441 | { |
442 | - return ! in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes()); |
|
442 | + return !in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes()); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | /** |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | */ |
480 | 480 | public function hasFieldWhere($attribute, $value) |
481 | 481 | { |
482 | - $match = Arr::first($this->getCleanStateFields(), function ($field, $fieldKey) use ($attribute, $value) { |
|
482 | + $match = Arr::first($this->getCleanStateFields(), function($field, $fieldKey) use ($attribute, $value) { |
|
483 | 483 | return isset($field[$attribute]) && $field[$attribute] == $value; |
484 | 484 | }); |
485 | 485 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | */ |
496 | 496 | public function firstFieldWhere($attribute, $value) |
497 | 497 | { |
498 | - return Arr::first($this->getCleanStateFields(), function ($field, $fieldKey) use ($attribute, $value) { |
|
498 | + return Arr::first($this->getCleanStateFields(), function($field, $fieldKey) use ($attribute, $value) { |
|
499 | 499 | return isset($field[$attribute]) && $field[$attribute] == $value; |
500 | 500 | }); |
501 | 501 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | |
594 | 594 | public function testCreateBelongsToFake() |
595 | 595 | { |
596 | - $belongsToField = [ // select_grouped |
|
596 | + $belongsToField = [// select_grouped |
|
597 | 597 | 'label' => 'Select_grouped', |
598 | 598 | 'type' => 'select_grouped', //https://github.com/Laravel-Backpack/CRUD/issues/502 |
599 | 599 | 'name' => 'bang_relation_field', |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | 'nickname' => 'i_have_has_one', |
728 | 728 | 'profile_picture' => 'ohh my picture 1.jpg', |
729 | 729 | 'article' => 1, |
730 | - 'addresses' => [ // HasOne is tested in other test function |
|
730 | + 'addresses' => [// HasOne is tested in other test function |
|
731 | 731 | [ |
732 | 732 | 'city' => 2, |
733 | 733 | 'street' => 'test', |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // - a single dimensional array: [1,2,3] |
112 | 112 | // - an array of arrays: [[1][2][3]] |
113 | 113 | // if is as single dimensional array we can only attach. |
114 | - if ($relationValues === null || ! is_multidimensional_array($relationValues)) { |
|
114 | + if ($relationValues === null || !is_multidimensional_array($relationValues)) { |
|
115 | 115 | $this->attachManyRelation($item, $relation, $relationDetails, $relationValues); |
116 | 116 | } else { |
117 | 117 | $this->createManyEntries($item, $relation, $relationMethod, $relationDetails); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | return $removedEntries->delete(); |
265 | 265 | } |
266 | 266 | |
267 | - if (! $relationColumnIsNullable && $modelInstance->dbColumnHasDefault($relationForeignKey)) { |
|
267 | + if (!$relationColumnIsNullable && $modelInstance->dbColumnHasDefault($relationForeignKey)) { |
|
268 | 268 | return $removedEntries->update([$relationForeignKey => $modelInstance->getDbColumnDefault($relationForeignKey)]); |
269 | 269 | } |
270 | 270 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | // use the collection of sent ids to match agains database ids, delete the ones not found in the submitted ids. |
311 | - if (! empty($relatedItemsSent)) { |
|
311 | + if (!empty($relatedItemsSent)) { |
|
312 | 312 | // we perform the cleanup of removed database items |
313 | 313 | $entry->{$relationMethod}()->whereNotIn($relation_local_key, $relatedItemsSent)->delete(); |
314 | 314 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | //remove fields that are not in the submitted form input |
100 | - $relationFields = array_filter($relationFields, function ($field) use ($input) { |
|
100 | + $relationFields = array_filter($relationFields, function($field) use ($input) { |
|
101 | 101 | return Arr::has($input, $field['name']) || isset($input[$field['name']]) || Arr::has($input, Str::afterLast($field['name'], '.')); |
102 | 102 | }); |
103 | 103 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | // when using dot notation if relationMethod is not set we are sure we want to exclude those relations. |
178 | 178 | if ($this->getOnlyRelationEntity($field) !== $field['entity']) { |
179 | - if (! $relationMethod) { |
|
179 | + if (!$relationMethod) { |
|
180 | 180 | $excludedFields[] = $nameToExclude; |
181 | 181 | } |
182 | 182 | continue; |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | - return Arr::where($input, function ($item, $key) use ($excludedFields) { |
|
192 | - return ! in_array($key, $excludedFields); |
|
191 | + return Arr::where($input, function($item, $key) use ($excludedFields) { |
|
192 | + return !in_array($key, $excludedFields); |
|
193 | 193 | }); |
194 | 194 | } |
195 | 195 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $model = $this->getRelationModel($entity, -1); |
66 | 66 | $lastSegmentAfterDot = Str::of($field['entity'])->afterLast('.'); |
67 | 67 | |
68 | - if (! method_exists($model, $lastSegmentAfterDot)) { |
|
68 | + if (!method_exists($model, $lastSegmentAfterDot)) { |
|
69 | 69 | return (string) Str::of($field['entity'])->beforeLast('.'); |
70 | 70 | } |
71 | 71 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | return collect($this->getCleanStateFields()) |
88 | 88 | ->whereIn('relation_type', $relation_types) |
89 | - ->filter(function ($item) use ($nested) { |
|
89 | + ->filter(function($item) use ($nested) { |
|
90 | 90 | if ($nested) { |
91 | 91 | return true; |
92 | 92 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | private function getRelationFieldsWithoutRelationType($relations, $fields = []) |
132 | 132 | { |
133 | - if (! is_array($relations)) { |
|
133 | + if (!is_array($relations)) { |
|
134 | 134 | $relations = [$relations]; |
135 | 135 | } |
136 | 136 | |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | foreach ($relations as $relation) { |
142 | - $fields = array_filter($fields, function ($field) use ($relation) { |
|
143 | - if (! isset($field['relation_type'])) { |
|
142 | + $fields = array_filter($fields, function($field) use ($relation) { |
|
143 | + if (!isset($field['relation_type'])) { |
|
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $fields = array_merge($field['subfields'], $fields); |
175 | 175 | } |
176 | 176 | } |
177 | - $fields = array_filter($fields, function ($field) { |
|
177 | + $fields = array_filter($fields, function($field) { |
|
178 | 178 | return isset($field['relation_type']) && $field['relation_type'] === 'BelongsTo'; |
179 | 179 | }); |
180 | 180 | } |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | { |
244 | 244 | $all_relation_fields = $this->getRelationFields(); |
245 | 245 | |
246 | - return Arr::where($all_relation_fields, function ($value, $key) { |
|
247 | - return isset($value['pivot']) && ! $value['pivot']; |
|
246 | + return Arr::where($all_relation_fields, function($value, $key) { |
|
247 | + return isset($value['pivot']) && !$value['pivot']; |
|
248 | 248 | }); |
249 | 249 | } |
250 | 250 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | { |
258 | 258 | $all_relation_fields = $this->getRelationFields(); |
259 | 259 | |
260 | - return Arr::where($all_relation_fields, function ($value, $key) { |
|
260 | + return Arr::where($all_relation_fields, function($value, $key) { |
|
261 | 261 | return isset($value['pivot']) && $value['pivot']; |
262 | 262 | }); |
263 | 263 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | // always have a hidden input for the entry id |
50 | - if (! array_key_exists('id', $fields)) { |
|
50 | + if (!array_key_exists('id', $fields)) { |
|
51 | 51 | $fields['id'] = [ |
52 | 52 | 'name' => $entry->getKeyName(), |
53 | 53 | 'value' => $entry->getKey(), |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $fieldEntity = $field['entity'] ?? false; |
73 | 73 | $fakeField = $field['fake'] ?? false; |
74 | 74 | |
75 | - if ($fieldEntity && ! $fakeField) { |
|
75 | + if ($fieldEntity && !$fakeField) { |
|
76 | 76 | return $this->getModelAttributeValueFromRelationship($model, $field); |
77 | 77 | } |
78 | 78 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | { |
103 | 103 | [$relatedModel, $relationMethod] = $this->getModelAndMethodFromEntity($model, $field); |
104 | 104 | |
105 | - if (! method_exists($relatedModel, $relationMethod)) { |
|
105 | + if (!method_exists($relatedModel, $relationMethod)) { |
|
106 | 106 | return $relatedModel->{$relationMethod}; |
107 | 107 | } |
108 | 108 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | foreach ($relationModels as $model) { |
121 | 121 | // when subfields are NOT set we don't need to get any more values |
122 | 122 | // we just return the plain models as we only need the ids |
123 | - if (! isset($field['subfields'])) { |
|
123 | + if (!isset($field['subfields'])) { |
|
124 | 124 | $result->push($model); |
125 | 125 | continue; |
126 | 126 | } |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | break; |
148 | 148 | case 'HasOne': |
149 | 149 | case 'MorphOne': |
150 | - if (! method_exists($relatedModel, $relationMethod)) { |
|
150 | + if (!method_exists($relatedModel, $relationMethod)) { |
|
151 | 151 | return; |
152 | 152 | } |
153 | 153 | |
154 | 154 | $model = $relatedModel->{$relationMethod}; |
155 | 155 | |
156 | - if (! $model) { |
|
156 | + if (!$model) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | $relationArray = explode('.', $relationEntity); |
217 | 217 | |
218 | - $relatedModel = array_reduce(array_splice($relationArray, 0, -1), function ($obj, $method) { |
|
218 | + $relatedModel = array_reduce(array_splice($relationArray, 0, -1), function($obj, $method) { |
|
219 | 219 | // if the string ends with `_id` we strip it out |
220 | 220 | $method = Str::endsWith($method, '_id') ? Str::replaceLast('_id', '', $method) : $method; |
221 | 221 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $name = is_string($subfield) ? $subfield : $subfield['name']; |
242 | 242 | // if the subfield name does not contain a dot we just need to check |
243 | 243 | // if it has subfields and return the result accordingly. |
244 | - if (! Str::contains($name, '.')) { |
|
244 | + if (!Str::contains($name, '.')) { |
|
245 | 245 | // when subfields are present, $relatedModel->{$name} returns a model instance |
246 | 246 | // otherwise returns the model attribute. |
247 | 247 | if ($relatedModel->{$name}) { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $iterator = $iterator->$part; |
262 | 262 | } |
263 | 263 | |
264 | - Arr::set($result, $name, (! is_string($iterator) && ! is_null($iterator) ? $this->getModelWithFakes($iterator)->getAttributes() : $iterator)); |
|
264 | + Arr::set($result, $name, (!is_string($iterator) && !is_null($iterator) ? $this->getModelWithFakes($iterator)->getAttributes() : $iterator)); |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if (array_key_exists($subfieldName, $requestInput) && $isSubfieldFake) { |
49 | 49 | $this->addCompactedField($requestInput, $subfieldName, $subFakeFieldKey); |
50 | 50 | |
51 | - if (! in_array($subFakeFieldKey, $compactedFakeFields)) { |
|
51 | + if (!in_array($subFakeFieldKey, $compactedFakeFields)) { |
|
52 | 52 | $compactedFakeFields[] = $subFakeFieldKey; |
53 | 53 | } |
54 | 54 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if (array_key_exists($fieldName, $requestInput) && $isFakeField) { |
60 | 60 | $this->addCompactedField($requestInput, $fieldName, $fakeFieldKey); |
61 | 61 | |
62 | - if (! in_array($fakeFieldKey, $compactedFakeFields)) { |
|
62 | + if (!in_array($fakeFieldKey, $compactedFakeFields)) { |
|
63 | 63 | $compactedFakeFields[] = $fakeFieldKey; |
64 | 64 | } |
65 | 65 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | // json_encode all fake_value columns if applicable in the database, so they can be properly stored and interpreted |
70 | 70 | foreach ($compactedFakeFields as $value) { |
71 | - if (! (property_exists($model, 'translatable') && in_array($value, $model->getTranslatableAttributes(), true)) && $model->shouldEncodeFake($value)) { |
|
71 | + if (!(property_exists($model, 'translatable') && in_array($value, $model->getTranslatableAttributes(), true)) && $model->shouldEncodeFake($value)) { |
|
72 | 72 | $requestInput[$value] = json_encode($requestInput[$value]); |
73 | 73 | } |
74 | 74 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function overwriteFieldNameFromDotNotationToArray($field) |
71 | 71 | { |
72 | - if (! is_array($field['name']) && strpos($field['name'], '.') !== false) { |
|
72 | + if (!is_array($field['name']) && strpos($field['name'], '.') !== false) { |
|
73 | 73 | $entity_array = explode('.', $field['name']); |
74 | 74 | $name_string = ''; |
75 | 75 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | return ['name' => $field]; |
112 | 112 | } |
113 | 113 | |
114 | - if (is_array($field) && ! isset($field['name'])) { |
|
114 | + if (is_array($field) && !isset($field['name'])) { |
|
115 | 115 | abort(500, 'All fields must have their name defined'); |
116 | 116 | } |
117 | 117 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | { |
177 | 177 | // if there's a model defined, but no attribute |
178 | 178 | // guess an attribute using the identifiableAttribute functionality in CrudTrait |
179 | - if (isset($field['model']) && ! isset($field['attribute']) && method_exists($field['model'], 'identifiableAttribute')) { |
|
179 | + if (isset($field['model']) && !isset($field['attribute']) && method_exists($field['model'], 'identifiableAttribute')) { |
|
180 | 180 | $field['attribute'] = call_user_func([(new $field['model']()), 'identifiableAttribute']); |
181 | 181 | } |
182 | 182 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | protected function makeSureFieldHasLabel($field) |
194 | 194 | { |
195 | - if (! isset($field['label'])) { |
|
195 | + if (!isset($field['label'])) { |
|
196 | 196 | $name = is_array($field['name']) ? $field['name'][0] : $field['name']; |
197 | 197 | $name = str_replace('_id', '', $name); |
198 | 198 | $field['label'] = mb_ucfirst(str_replace('_', ' ', $name)); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | protected function makeSureFieldHasType($field) |
212 | 212 | { |
213 | - if (! isset($field['type'])) { |
|
213 | + if (!isset($field['type'])) { |
|
214 | 214 | $field['type'] = isset($field['relation_type']) ? $this->inferFieldTypeFromRelationType($field['relation_type']) : $this->inferFieldTypeFromDbColumnType($field['name']); |
215 | 215 | } |
216 | 216 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | protected function makeSureSubfieldsHaveNecessaryAttributes($field) |
249 | 249 | { |
250 | - if (! isset($field['subfields'])) { |
|
250 | + if (!isset($field['subfields'])) { |
|
251 | 251 | return $field; |
252 | 252 | } |
253 | 253 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $subfield = ['name' => $subfield]; |
258 | 258 | } |
259 | 259 | |
260 | - if (! isset($field['model'])) { |
|
260 | + if (!isset($field['model'])) { |
|
261 | 261 | // we're inside a simple 'repeatable' with no model/relationship, so |
262 | 262 | // we assume all subfields are supposed to be text fields |
263 | 263 | $subfield['type'] = $subfield['type'] ?? 'text'; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | { |
309 | 309 | // if a tab was mentioned, we should enable it |
310 | 310 | if (isset($field['tab'])) { |
311 | - if (! $this->tabsEnabled()) { |
|
311 | + if (!$this->tabsEnabled()) { |
|
312 | 312 | $this->enableTabs(); |
313 | 313 | } |
314 | 314 | } |