We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | <?php |
4 | 4 | // if the column has been cast to Carbon or Date (using attribute casting) |
5 | 5 | // get the value as a date string |
6 | - if (! function_exists('formatDate')) { |
|
6 | + if (!function_exists('formatDate')) { |
|
7 | 7 | function formatDate($entry, $dateFieldName) |
8 | 8 | { |
9 | 9 | $formattedDate = null; |
10 | - if (isset($entry) && ! empty($entry->{$dateFieldName})) { |
|
10 | + if (isset($entry) && !empty($entry->{$dateFieldName})) { |
|
11 | 11 | $dateField = $entry->{$dateFieldName}; |
12 | 12 | if ($dateField instanceof \Carbon\CarbonInterface) { |
13 | 13 | $formattedDate = $dateField->format('Y-m-d H:i:s'); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } |
22 | 22 | |
23 | 23 | if (isset($field['value'])) { |
24 | - if (isset($entry) && ! is_array($field['value'])) { |
|
24 | + if (isset($entry) && !is_array($field['value'])) { |
|
25 | 25 | $start_value = formatDate($entry, $field['name'][0]); |
26 | 26 | $end_value = formatDate($entry, $field['name'][1]); |
27 | 27 | } elseif (is_array($field['value'])) { // gets here when inside repeatable |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function applySearchTerm($searchTerm) |
23 | 23 | { |
24 | - return $this->query->where(function ($query) use ($searchTerm) { |
|
24 | + return $this->query->where(function($query) use ($searchTerm) { |
|
25 | 25 | foreach ($this->columns() as $column) { |
26 | - if (! isset($column['type'])) { |
|
26 | + if (!isset($column['type'])) { |
|
27 | 27 | abort(400, 'Missing column type when trying to apply search term.'); |
28 | 28 | } |
29 | 29 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | case 'select': |
83 | 83 | case 'select_multiple': |
84 | - $query->orWhereHas($column['entity'], function ($q) use ($column, $searchTerm) { |
|
84 | + $query->orWhereHas($column['entity'], function($q) use ($column, $searchTerm) { |
|
85 | 85 | $q->where($this->getColumnWithTableNamePrefixed($q, $column['attribute']), 'like', '%'.$searchTerm.'%'); |
86 | 86 | }); |
87 | 87 | break; |
@@ -270,13 +270,13 @@ discard block |
||
270 | 270 | if (isset($column['type'])) { |
271 | 271 | // create a list of paths to column blade views |
272 | 272 | // including the configured view_namespaces |
273 | - $columnPaths = array_map(function ($item) use ($column) { |
|
273 | + $columnPaths = array_map(function($item) use ($column) { |
|
274 | 274 | return $item.'.'.$column['type']; |
275 | 275 | }, config('backpack.crud.view_namespaces.columns')); |
276 | 276 | |
277 | 277 | // but always fall back to the stock 'text' column |
278 | 278 | // if a view doesn't exist |
279 | - if (! in_array('crud::columns.text', $columnPaths)) { |
|
279 | + if (!in_array('crud::columns.text', $columnPaths)) { |
|
280 | 280 | $columnPaths[] = 'crud::columns.text'; |
281 | 281 | } |
282 | 282 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | */ |
304 | 304 | private function renderCellView($view, $column, $entry, $rowNumber = false) |
305 | 305 | { |
306 | - if (! view()->exists($view)) { |
|
306 | + if (!view()->exists($view)) { |
|
307 | 307 | $view = 'crud::columns.text'; // fallback to text column |
308 | 308 | } |
309 | 309 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | // always have a hidden input for the entry id |
59 | - if (! array_key_exists('id', $fields)) { |
|
59 | + if (!array_key_exists('id', $fields)) { |
|
60 | 60 | $fields['id'] = [ |
61 | 61 | 'name' => $entry->getKeyName(), |
62 | 62 | 'value' => $entry->getKey(), |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | [$related_model, $relation_method] = $this->getModelAndMethodFromEntity($model, $field); |
100 | 100 | |
101 | - if (! method_exists($related_model, $relation_method)) { |
|
101 | + if (!method_exists($related_model, $relation_method)) { |
|
102 | 102 | return $related_model->{$relation_method}; |
103 | 103 | } |
104 | 104 | |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | case 'BelongsToMany': |
111 | 111 | case 'MorphToMany': |
112 | 112 | // use subfields aka. pivotFields |
113 | - if (! isset($field['subfields'])) { |
|
113 | + if (!isset($field['subfields'])) { |
|
114 | 114 | return $related_model->{$relation_method}; |
115 | 115 | } |
116 | 116 | // we want to exclude the "self pivot field" since we already have it. |
117 | - $pivot_fields = Arr::where($field['subfields'], function ($item) use ($field) { |
|
117 | + $pivot_fields = Arr::where($field['subfields'], function($item) use ($field) { |
|
118 | 118 | return $field['name'] != $item['name']; |
119 | 119 | }); |
120 | 120 | |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | break; |
145 | 145 | case 'HasOne': |
146 | 146 | case 'MorphOne': |
147 | - if (! method_exists($related_model, $relation_method)) { |
|
147 | + if (!method_exists($related_model, $relation_method)) { |
|
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
151 | 151 | $related_entry = $related_model->{$relation_method}; |
152 | 152 | |
153 | - if (! $related_entry) { |
|
153 | + if (!$related_entry) { |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $relation_array = explode('.', $relational_entity); |
185 | 185 | |
186 | - $related_model = array_reduce(array_splice($relation_array, 0, -1), function ($obj, $method) { |
|
186 | + $related_model = array_reduce(array_splice($relation_array, 0, -1), function($obj, $method) { |
|
187 | 187 | $method = Str::endsWith($method, '_id') ? Str::replaceLast('_id', '', $method) : $method; |
188 | 188 | |
189 | 189 | return $obj->{$method} ? $obj->{$method} : $obj; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $fields_with_pivot = $this->getRelationFieldsWithPivot(); |
109 | 109 | |
110 | 110 | //remove fields that are not in the submitted form input |
111 | - $fields_with_pivot = array_filter($fields_with_pivot, function ($item) use ($input) { |
|
111 | + $fields_with_pivot = array_filter($fields_with_pivot, function($item) use ($input) { |
|
112 | 112 | return Arr::has($input, $item['name']); |
113 | 113 | }); |
114 | 114 | |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | */ |
164 | 164 | private function createRelationsForItem($item, $formattedRelations) |
165 | 165 | { |
166 | - if (! isset($formattedRelations['relations'])) { |
|
166 | + if (!isset($formattedRelations['relations'])) { |
|
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | foreach ($formattedRelations['relations'] as $relationMethod => $relationDetails) { |
170 | - if (! isset($relationDetails['model'])) { |
|
170 | + if (!isset($relationDetails['model'])) { |
|
171 | 171 | continue; |
172 | 172 | } |
173 | 173 | $model = $relationDetails['model']; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | return $removed_entries->delete(); |
304 | 304 | } |
305 | 305 | |
306 | - if (! $relation_column_is_nullable && $model_instance->dbColumnHasDefault($relation_foreign_key)) { |
|
306 | + if (!$relation_column_is_nullable && $model_instance->dbColumnHasDefault($relation_foreign_key)) { |
|
307 | 307 | return $removed_entries->update([$relation_foreign_key => $model_instance->getDbColumnDefault($relation_foreign_key)]); |
308 | 308 | } |
309 | 309 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $created_ids = []; |
327 | 327 | |
328 | 328 | foreach ($items as $item) { |
329 | - if (isset($item[$relation_local_key]) && ! empty($item[$relation_local_key])) { |
|
329 | + if (isset($item[$relation_local_key]) && !empty($item[$relation_local_key])) { |
|
330 | 330 | $entry->{$relationMethod}()->where($relation_local_key, $item[$relation_local_key])->update(Arr::except($item, $relation_local_key)); |
331 | 331 | } else { |
332 | 332 | $created_ids[] = $entry->{$relationMethod}()->create($item)->{$relation_local_key}; |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | // get from $items the sent ids, and merge the ones created. |
337 | 337 | $relatedItemsSent = array_merge(array_filter(Arr::pluck($items, $relation_local_key)), $created_ids); |
338 | 338 | |
339 | - if (! empty($relatedItemsSent)) { |
|
339 | + if (!empty($relatedItemsSent)) { |
|
340 | 340 | // we perform the cleanup of removed database items |
341 | 341 | $entry->{$relationMethod}()->whereNotIn($relation_local_key, $relatedItemsSent)->delete(); |
342 | 342 | } |
@@ -366,12 +366,12 @@ discard block |
||
366 | 366 | $relationFields = $this->getRelationFieldsWithoutPivot(); |
367 | 367 | |
368 | 368 | //remove fields that are not in the submitted form input |
369 | - $relationFields = array_filter($relationFields, function ($item) use ($input) { |
|
369 | + $relationFields = array_filter($relationFields, function($item) use ($input) { |
|
370 | 370 | return Arr::has($input, $item['name']); |
371 | 371 | }); |
372 | 372 | |
373 | 373 | // exclude the already attached belongs to relations in the main entry but include nested belongs to. |
374 | - $relationFields = Arr::where($relationFields, function ($field, $key) { |
|
374 | + $relationFields = Arr::where($relationFields, function($field, $key) { |
|
375 | 375 | return $field['relation_type'] !== 'BelongsTo' || ($field['relation_type'] === 'BelongsTo' && Str::contains($field['name'], '.')); |
376 | 376 | }); |
377 | 377 |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | { |
275 | 275 | $type = $this->name; |
276 | 276 | |
277 | - $paths = array_map(function ($item) use ($type) { |
|
277 | + $paths = array_map(function($item) use ($type) { |
|
278 | 278 | return $item.'.'.$type; |
279 | 279 | }, config('backpack.crud.view_namespaces.buttons')); |
280 | 280 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | { |
441 | 441 | $itemExists = $this->collection()->contains('name', $this->name); |
442 | 442 | |
443 | - if (! $itemExists) { |
|
443 | + if (!$itemExists) { |
|
444 | 444 | if ($this->position == 'beginning') { |
445 | 445 | $this->collection()->prepend($this); |
446 | 446 | } else { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function wasNotApplied() |
86 | 86 | { |
87 | - return ! $this->applied; |
|
87 | + return !$this->applied; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | $input = $input ?? new ParameterBag($this->crud()->getRequest()->all()); |
107 | 107 | |
108 | - if (! $input->has($this->name)) { |
|
108 | + if (!$input->has($this->name)) { |
|
109 | 109 | // if fallback logic was supplied and is a closure |
110 | 110 | if (is_callable($this->fallbackLogic)) { |
111 | 111 | return ($this->fallbackLogic)(); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | { |
143 | 143 | $type = $this->type; |
144 | 144 | |
145 | - return array_map(function ($item) use ($type) { |
|
145 | + return array_map(function($item) use ($type) { |
|
146 | 146 | return $item.'.'.$type; |
147 | 147 | }, config('backpack.crud.view_namespaces.filters')); |
148 | 148 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function values($value) |
306 | 306 | { |
307 | - $this->values = (! is_string($value) && is_callable($value)) ? $value() : $value; |
|
307 | + $this->values = (!is_string($value) && is_callable($value)) ? $value() : $value; |
|
308 | 308 | |
309 | 309 | return $this->save(); |
310 | 310 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | $type = $this->type; |
137 | - $paths = array_map(function ($item) use ($type) { |
|
137 | + $paths = array_map(function($item) use ($type) { |
|
138 | 138 | return $item.'.'.$type; |
139 | 139 | }, config('backpack.base.component_view_namespaces.widgets')); |
140 | 140 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $itemExists = $this->collection()->contains('name', $this->attributes['name']); |
229 | 229 | |
230 | - if (! $itemExists) { |
|
230 | + if (!$itemExists) { |
|
231 | 231 | $this->collection()->put($this->attributes['name'], $this); |
232 | 232 | } else { |
233 | 233 | $this->collection()[$this->name] = $this; |