We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return ['name' => Str::replace(' ', '', $field)]; |
116 | 116 | } |
117 | 117 | |
118 | - if (is_array($field) && ! isset($field['name'])) { |
|
118 | + if (is_array($field) && !isset($field['name'])) { |
|
119 | 119 | abort(500, 'All fields must have their name defined'); |
120 | 120 | } |
121 | 121 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | // if there's a model defined, but no attribute |
191 | 191 | // guess an attribute using the identifiableAttribute functionality in CrudTrait |
192 | - if (isset($field['model']) && ! isset($field['attribute']) && method_exists($field['model'], 'identifiableAttribute')) { |
|
192 | + if (isset($field['model']) && !isset($field['attribute']) && method_exists($field['model'], 'identifiableAttribute')) { |
|
193 | 193 | $field['attribute'] = (new $field['model']())->identifiableAttribute(); |
194 | 194 | } |
195 | 195 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | protected function makeSureFieldHasLabel($field) |
207 | 207 | { |
208 | - if (! isset($field['label'])) { |
|
208 | + if (!isset($field['label'])) { |
|
209 | 209 | $name = str_replace(',', ' ', $field['name']); |
210 | 210 | $name = str_replace('_id', '', $name); |
211 | 211 | $field['label'] = mb_ucfirst(str_replace('_', ' ', $name)); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | protected function makeSureFieldHasType($field) |
225 | 225 | { |
226 | - if (! isset($field['type'])) { |
|
226 | + if (!isset($field['type'])) { |
|
227 | 227 | $field['type'] = isset($field['relation_type']) ? $this->inferFieldTypeFromRelationType($field['relation_type']) : $this->inferFieldTypeFromDbColumnType($field['name']); |
228 | 228 | } |
229 | 229 | |
@@ -256,16 +256,16 @@ discard block |
||
256 | 256 | */ |
257 | 257 | protected function makeSureSubfieldsHaveNecessaryAttributes($field) |
258 | 258 | { |
259 | - if (! isset($field['subfields']) || ! is_array($field['subfields'])) { |
|
259 | + if (!isset($field['subfields']) || !is_array($field['subfields'])) { |
|
260 | 260 | return $field; |
261 | 261 | } |
262 | 262 | |
263 | - if (! is_multidimensional_array($field['subfields'], true)) { |
|
263 | + if (!is_multidimensional_array($field['subfields'], true)) { |
|
264 | 264 | abort(500, 'Subfields of «'.$field['name'].'» are malformed. Make sure you provide an array of subfields.'); |
265 | 265 | } |
266 | 266 | |
267 | 267 | foreach ($field['subfields'] as $key => $subfield) { |
268 | - if (empty($subfield) || ! isset($subfield['name'])) { |
|
268 | + if (empty($subfield) || !isset($subfield['name'])) { |
|
269 | 269 | abort(500, 'A subfield of «'.$field['name'].'» is malformed. Subfield attribute name can\'t be empty.'); |
270 | 270 | } |
271 | 271 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | $subfield['parentFieldName'] = $field['name']; |
280 | 280 | |
281 | - if (! isset($field['model'])) { |
|
281 | + if (!isset($field['model'])) { |
|
282 | 282 | // we're inside a simple 'repeatable' with no model/relationship, so |
283 | 283 | // we assume all subfields are supposed to be text fields |
284 | 284 | $subfield['type'] = $subfield['type'] ?? 'text'; |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | case 'BelongsToMany': |
306 | 306 | $pivotSelectorField = static::getPivotFieldStructure($field); |
307 | 307 | |
308 | - $pivot = Arr::where($field['subfields'], function ($item) use ($pivotSelectorField) { |
|
308 | + $pivot = Arr::where($field['subfields'], function($item) use ($pivotSelectorField) { |
|
309 | 309 | return $item['name'] === $pivotSelectorField['name']; |
310 | 310 | }); |
311 | 311 | |
312 | - if (! empty($pivot)) { |
|
312 | + if (!empty($pivot)) { |
|
313 | 313 | break; |
314 | 314 | } |
315 | 315 | |
316 | - if($field['allow_multiple_pivots'] ?? false) { |
|
316 | + if ($field['allow_multiple_pivots'] ?? false) { |
|
317 | 317 | $pivotSelectorField['allow_multiple_pivots'] = true; |
318 | 318 | $field['subfields'] = Arr::prepend($field['subfields'], [ |
319 | 319 | 'name' => $field['pivot_key_name'] ?? 'id', |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | $entity = isset($field['baseEntity']) ? $field['baseEntity'].'.'.$field['entity'] : $field['entity']; |
337 | 337 | $relationInstance = $this->getRelationInstance(['entity' => $entity]); |
338 | 338 | |
339 | - $localKeyField = Arr::where($field['subfields'], function ($item) use ($relationInstance) { |
|
339 | + $localKeyField = Arr::where($field['subfields'], function($item) use ($relationInstance) { |
|
340 | 340 | return $item['name'] === $relationInstance->getRelated()->getKeyName(); |
341 | 341 | }); |
342 | 342 | |
343 | - if (! empty($localKeyField)) { |
|
343 | + if (!empty($localKeyField)) { |
|
344 | 344 | break; |
345 | 345 | } |
346 | 346 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | { |
366 | 366 | // if a tab was mentioned, we should enable it |
367 | 367 | if (isset($field['tab'])) { |
368 | - if (! $this->tabsEnabled()) { |
|
368 | + if (!$this->tabsEnabled()) { |
|
369 | 369 | $this->enableTabs(); |
370 | 370 | } |
371 | 371 | } |
@@ -154,7 +154,7 @@ |
||
154 | 154 | if(isset($value[$keyName])) { |
155 | 155 | $relation->newPivot()->where($keyName, $value[$keyName])->update($this->preparePivotAttributesForUpdate($value, $relation)); |
156 | 156 | } else { |
157 | - $relation->newPivot()->create($this->preparePivotAttributesForCreate($value, $relation, $item->getKey())); |
|
157 | + $relation->newPivot()->create($this->preparePivotAttributesForCreate($value, $relation, $item->getKey())); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | break; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // - a single dimensional array: [1,2,3] |
124 | 124 | // - an array of arrays: [[1][2][3]] |
125 | 125 | // if is as single dimensional array we can only attach. |
126 | - if ($relationValues === null || ! is_multidimensional_array($relationValues)) { |
|
126 | + if ($relationValues === null || !is_multidimensional_array($relationValues)) { |
|
127 | 127 | $this->attachManyRelation($item, $relation, $relationDetails, $relationValues); |
128 | 128 | } else { |
129 | 129 | $this->createManyEntries($item, $relation, $relationMethod, $relationDetails); |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | $dbValues = $relation->get()->pluck($keyName)->all(); |
145 | 145 | $toDelete = array_diff($dbValues, $sentIds); |
146 | 146 | |
147 | - if (! empty($toDelete)) { |
|
148 | - foreach($toDelete as $id) { |
|
147 | + if (!empty($toDelete)) { |
|
148 | + foreach ($toDelete as $id) { |
|
149 | 149 | $relation->newPivot()->where($keyName, $id)->delete(); |
150 | 150 | } |
151 | 151 | } |
152 | - foreach($values as $value) { |
|
152 | + foreach ($values as $value) { |
|
153 | 153 | // if it's an existing pivot, update it |
154 | - if(isset($value[$keyName])) { |
|
154 | + if (isset($value[$keyName])) { |
|
155 | 155 | $relation->newPivot()->where($keyName, $value[$keyName])->update($this->preparePivotAttributesForUpdate($value, $relation)); |
156 | 156 | } else { |
157 | 157 | $relation->newPivot()->create($this->preparePivotAttributesForCreate($value, $relation, $item->getKey())); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - private function preparePivotAttributesForCreate(array $attributes, BelongsToMany $relation, string|int $relatedItemKey) { |
|
187 | + private function preparePivotAttributesForCreate(array $attributes, BelongsToMany $relation, string | int $relatedItemKey) { |
|
188 | 188 | $attributes[$relation->getForeignPivotKeyName()] = $relatedItemKey; |
189 | 189 | $attributes[$relation->getRelatedPivotKeyName()] = $attributes[$relation->getRelationName()]; |
190 | 190 | $pivotKeyName = $attributes['pivot_key_name'] ?? 'id'; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | } |
332 | 332 | // if column is not nullable in database, and there is no column default (null), |
333 | 333 | // we will delete the entry from the database, otherwise it will throw and ugly DB error. |
334 | - if (! $relationColumnIsNullable && $dbColumnDefault === null) { |
|
334 | + if (!$relationColumnIsNullable && $dbColumnDefault === null) { |
|
335 | 335 | return $removedEntries->lazy()->each->delete(); |
336 | 336 | } |
337 | 337 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | // use the collection of sent ids to match against database ids, delete the ones not found in the submitted ids. |
379 | - if (! empty($relatedItemsSent)) { |
|
379 | + if (!empty($relatedItemsSent)) { |
|
380 | 380 | // we perform the cleanup of removed database items |
381 | 381 | $entry->{$relationMethod}()->whereNotIn($relatedModelLocalKey, $relatedItemsSent)->lazy()->each->delete(); |
382 | 382 | } |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | |
760 | 760 | public function testCreateBelongsToFake() |
761 | 761 | { |
762 | - $belongsToField = [ // select_grouped |
|
762 | + $belongsToField = [// select_grouped |
|
763 | 763 | 'label' => 'Select_grouped', |
764 | 764 | 'type' => 'select_grouped', //https://github.com/Laravel-Backpack/CRUD/issues/502 |
765 | 765 | 'name' => 'bang_relation_field', |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | 'nickname' => 'i_have_has_one', |
896 | 896 | 'profile_picture' => 'ohh my picture 1.jpg', |
897 | 897 | 'article' => 1, |
898 | - 'addresses' => [ // HasOne is tested in other test function |
|
898 | + 'addresses' => [// HasOne is tested in other test function |
|
899 | 899 | [ |
900 | 900 | 'city' => 2, |
901 | 901 | 'street' => 'test', |
@@ -1645,7 +1645,7 @@ discard block |
||
1645 | 1645 | { |
1646 | 1646 | $faker = Factory::create(); |
1647 | 1647 | |
1648 | - if($initCrud) { |
|
1648 | + if ($initCrud) { |
|
1649 | 1649 | $this->crudPanel->setModel(User::class); |
1650 | 1650 | $this->crudPanel->addFields($this->userInputFieldsNoRelationships); |
1651 | 1651 | $this->crudPanel->addField([ |