We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -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; |
@@ -596,7 +596,7 @@ |
||
596 | 596 | 'nickname' => 'i_have_has_one', |
597 | 597 | 'profile_picture' => 'ohh my picture 1.jpg', |
598 | 598 | 'article' => 1, |
599 | - 'addresses' => [ // HasOne is tested in other test function |
|
599 | + 'addresses' => [// HasOne is tested in other test function |
|
600 | 600 | [ |
601 | 601 | 'city' => 'test', |
602 | 602 | 'street' => 'test', |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('comments', function (Blueprint $table) { |
|
16 | + Schema::create('comments', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->string('text')->nullable(); |
19 | 19 | $table->morphs('commentable'); |
20 | 20 | $table->timestamps(); |
21 | 21 | }); |
22 | 22 | |
23 | - Schema::create('recommendables', function (Blueprint $table) { |
|
23 | + Schema::create('recommendables', function(Blueprint $table) { |
|
24 | 24 | $table->bigIncrements('id'); |
25 | 25 | $table->string('text')->nullable(); |
26 | 26 | $table->morphs('recommendable'); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $table->timestamps(); |
29 | 29 | }); |
30 | 30 | |
31 | - Schema::create('billables', function (Blueprint $table) { |
|
31 | + Schema::create('billables', function(Blueprint $table) { |
|
32 | 32 | $table->bigIncrements('id'); |
33 | 33 | $table->string('text')->nullable(); |
34 | 34 | $table->morphs('billable'); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $table->timestamps(); |
37 | 37 | }); |
38 | 38 | |
39 | - Schema::create('articles_user', function (Blueprint $table) { |
|
39 | + Schema::create('articles_user', function(Blueprint $table) { |
|
40 | 40 | $table->increments('id'); |
41 | 41 | $table->integer('article_id')->unsigned(); |
42 | 42 | $table->integer('user_id')->unsigned(); |
@@ -44,54 +44,54 @@ discard block |
||
44 | 44 | $table->nullableTimestamps(); |
45 | 45 | }); |
46 | 46 | |
47 | - Schema::create('recommends', function (Blueprint $table) { |
|
47 | + Schema::create('recommends', function(Blueprint $table) { |
|
48 | 48 | $table->bigIncrements('id'); |
49 | 49 | $table->string('title')->nullable(); |
50 | 50 | $table->timestamps(); |
51 | 51 | }); |
52 | 52 | |
53 | - Schema::create('bills', function (Blueprint $table) { |
|
53 | + Schema::create('bills', function(Blueprint $table) { |
|
54 | 54 | $table->bigIncrements('id'); |
55 | 55 | $table->string('title')->nullable(); |
56 | 56 | $table->timestamps(); |
57 | 57 | }); |
58 | 58 | |
59 | - Schema::create('stars', function (Blueprint $table) { |
|
59 | + Schema::create('stars', function(Blueprint $table) { |
|
60 | 60 | $table->bigIncrements('id'); |
61 | 61 | $table->string('starable_type'); |
62 | 62 | $table->bigInteger('starable_id'); |
63 | 63 | $table->string('title')->nullable(); |
64 | 64 | }); |
65 | 65 | |
66 | - Schema::create('universes', function (Blueprint $table) { |
|
66 | + Schema::create('universes', function(Blueprint $table) { |
|
67 | 67 | $table->bigIncrements('id'); |
68 | 68 | $table->bigInteger('user_id'); |
69 | 69 | $table->string('title')->nullable(); |
70 | 70 | }); |
71 | 71 | |
72 | - Schema::create('planets', function (Blueprint $table) { |
|
72 | + Schema::create('planets', function(Blueprint $table) { |
|
73 | 73 | $table->bigIncrements('id'); |
74 | 74 | $table->bigInteger('user_id')->nullable(); |
75 | 75 | $table->string('title')->nullable(); |
76 | 76 | }); |
77 | 77 | |
78 | - Schema::create('comets', function (Blueprint $table) { |
|
78 | + Schema::create('comets', function(Blueprint $table) { |
|
79 | 79 | $table->bigIncrements('id'); |
80 | 80 | $table->bigInteger('user_id')->default(0); |
81 | 81 | }); |
82 | 82 | |
83 | - Schema::create('bangs', function (Blueprint $table) { |
|
83 | + Schema::create('bangs', function(Blueprint $table) { |
|
84 | 84 | $table->bigIncrements('id'); |
85 | 85 | $table->string('name'); |
86 | 86 | }); |
87 | 87 | |
88 | - Schema::create('account_details_bang', function (Blueprint $table) { |
|
88 | + Schema::create('account_details_bang', function(Blueprint $table) { |
|
89 | 89 | $table->bigIncrements('id'); |
90 | 90 | $table->bigInteger('account_details_id'); |
91 | 91 | $table->bigInteger('bang_id'); |
92 | 92 | }); |
93 | 93 | |
94 | - Schema::create('account_details_bangs_pivot', function (Blueprint $table) { |
|
94 | + Schema::create('account_details_bangs_pivot', function(Blueprint $table) { |
|
95 | 95 | $table->bigIncrements('id'); |
96 | 96 | $table->bigInteger('account_details_id'); |
97 | 97 | $table->bigInteger('bang_id'); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('backpack_url')) { |
|
3 | +if (!function_exists('backpack_url')) { |
|
4 | 4 | /** |
5 | 5 | * Appends the configured backpack prefix and returns |
6 | 6 | * the URL using the standard Laravel helpers. |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | function backpack_url($path = null, $parameters = [], $secure = null) |
12 | 12 | { |
13 | - $path = ! $path || (substr($path, 0, 1) == '/') ? $path : '/'.$path; |
|
13 | + $path = !$path || (substr($path, 0, 1) == '/') ? $path : '/'.$path; |
|
14 | 14 | |
15 | 15 | return url(config('backpack.base.route_prefix', 'admin').$path, $parameters, $secure); |
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
19 | -if (! function_exists('backpack_authentication_column')) { |
|
19 | +if (!function_exists('backpack_authentication_column')) { |
|
20 | 20 | /** |
21 | 21 | * Return the username column name. |
22 | 22 | * The Laravel default (and Backpack default) is 'email'. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -if (! function_exists('backpack_form_input')) { |
|
32 | +if (!function_exists('backpack_form_input')) { |
|
33 | 33 | /** |
34 | 34 | * Parse the submitted input in request('form') to an usable array. |
35 | 35 | * Joins the multiple[] fields in a single key and transform the dot notation fields into arrayed ones. |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | if (is_null($input_arg)) { |
61 | - if (! isset($result[$input_key])) { |
|
61 | + if (!isset($result[$input_key])) { |
|
62 | 62 | $result[$input_key] = $start ? [$row['value']] : $row['value']; |
63 | 63 | } else { |
64 | 64 | array_push($result[$input_key], $row['value']); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | -if (! function_exists('backpack_users_have_email')) { |
|
75 | +if (!function_exists('backpack_users_have_email')) { |
|
76 | 76 | /** |
77 | 77 | * Check if the email column is present on the user table. |
78 | 78 | * |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -if (! function_exists('backpack_avatar_url')) { |
|
90 | +if (!function_exists('backpack_avatar_url')) { |
|
91 | 91 | /** |
92 | 92 | * Returns the avatar URL of a user. |
93 | 93 | * |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | -if (! function_exists('backpack_middleware')) { |
|
122 | +if (!function_exists('backpack_middleware')) { |
|
123 | 123 | /** |
124 | 124 | * Return the key of the middleware used across Backpack. |
125 | 125 | * That middleware checks if the visitor is an admin. |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | -if (! function_exists('backpack_guard_name')) { |
|
136 | +if (!function_exists('backpack_guard_name')) { |
|
137 | 137 | /* |
138 | 138 | * Returns the name of the guard defined |
139 | 139 | * by the application config |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | -if (! function_exists('backpack_auth')) { |
|
147 | +if (!function_exists('backpack_auth')) { |
|
148 | 148 | /* |
149 | 149 | * Returns the user instance if it exists |
150 | 150 | * of the currently authenticated admin |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | -if (! function_exists('backpack_user')) { |
|
159 | +if (!function_exists('backpack_user')) { |
|
160 | 160 | /* |
161 | 161 | * Returns back a user instance without |
162 | 162 | * the admin guard, however allows you |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | -if (! function_exists('mb_ucfirst')) { |
|
171 | +if (!function_exists('mb_ucfirst')) { |
|
172 | 172 | /** |
173 | 173 | * Capitalize the first letter of a string, |
174 | 174 | * even if that string is multi-byte (non-latin alphabet). |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | -if (! function_exists('backpack_view')) { |
|
192 | +if (!function_exists('backpack_view')) { |
|
193 | 193 | /** |
194 | 194 | * Returns a new displayable view based on the configured backpack view namespace. |
195 | 195 | * If that view doesn't exist, it will load the one from the original theme. |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | $returnView = $theme.$view; |
210 | 210 | |
211 | - if (! view()->exists($returnView)) { |
|
211 | + if (!view()->exists($returnView)) { |
|
212 | 212 | $returnView = $originalTheme.$view; |
213 | 213 | } |
214 | 214 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | -if (! function_exists('square_brackets_to_dots')) { |
|
219 | +if (!function_exists('square_brackets_to_dots')) { |
|
220 | 220 | /** |
221 | 221 | * Turns a string from bracket-type array to dot-notation array. |
222 | 222 | * Ex: array[0][property] turns into array.0.property. |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
235 | -if (! function_exists('is_countable')) { |
|
235 | +if (!function_exists('is_countable')) { |
|
236 | 236 | /** |
237 | 237 | * We need this because is_countable was only introduced in PHP 7.3, |
238 | 238 | * and in PHP 7.2 you should check if count() argument is really countable. |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | -if (! function_exists('old_empty_or_null')) { |
|
250 | +if (!function_exists('old_empty_or_null')) { |
|
251 | 251 | /** |
252 | 252 | * This method is an alternative to Laravel's old() helper, which mistakenly |
253 | 253 | * returns NULL it two cases: |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | -if (! function_exists('is_multidimensional_array')) { |
|
282 | +if (!function_exists('is_multidimensional_array')) { |
|
283 | 283 | /** |
284 | 284 | * If any of the items inside a given array is an array, the array is considered multidimensional. |
285 | 285 | * |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $model = $this->getRelationModel($entity, -1); |
72 | 72 | $lastSegmentAfterDot = Str::of($field['entity'])->afterLast('.'); |
73 | 73 | |
74 | - if (! method_exists($model, $lastSegmentAfterDot)) { |
|
74 | + if (!method_exists($model, $lastSegmentAfterDot)) { |
|
75 | 75 | return (string) Str::of($field['entity'])->beforeLast('.'); |
76 | 76 | } |
77 | 77 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | return collect($this->getCleanStateFields()) |
94 | 94 | ->whereIn('relation_type', $relation_types) |
95 | - ->filter(function ($item) use ($nested) { |
|
95 | + ->filter(function($item) use ($nested) { |
|
96 | 96 | if ($nested) { |
97 | 97 | return true; |
98 | 98 | } |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | */ |
137 | 137 | private function getRelationFieldsWithoutRelationType($relations, $include_nested = false) |
138 | 138 | { |
139 | - if (! is_array($relations)) { |
|
139 | + if (!is_array($relations)) { |
|
140 | 140 | $relations = [$relations]; |
141 | 141 | } |
142 | 142 | |
143 | 143 | $fields = $this->getRelationFields(); |
144 | 144 | |
145 | 145 | foreach ($relations as $relation) { |
146 | - $fields = array_filter($fields, function ($field) use ($relation, $include_nested) { |
|
146 | + $fields = array_filter($fields, function($field) use ($relation, $include_nested) { |
|
147 | 147 | if ($include_nested) { |
148 | 148 | return $field['relation_type'] !== $relation || ($field['relation_type'] === $relation && Str::contains($field['name'], '.')); |
149 | 149 | } |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | { |
229 | 229 | $all_relation_fields = $this->getRelationFields(); |
230 | 230 | |
231 | - return Arr::where($all_relation_fields, function ($value, $key) { |
|
232 | - return isset($value['pivot']) && ! $value['pivot']; |
|
231 | + return Arr::where($all_relation_fields, function($value, $key) { |
|
232 | + return isset($value['pivot']) && !$value['pivot']; |
|
233 | 233 | }); |
234 | 234 | } |
235 | 235 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | { |
243 | 243 | $all_relation_fields = $this->getRelationFields(); |
244 | 244 | |
245 | - return Arr::where($all_relation_fields, function ($value, $key) { |
|
245 | + return Arr::where($all_relation_fields, function($value, $key) { |
|
246 | 246 | return isset($value['pivot']) && $value['pivot']; |
247 | 247 | }); |
248 | 248 | } |
@@ -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,7 +110,7 @@ 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 | |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | break; |
141 | 141 | case 'HasOne': |
142 | 142 | case 'MorphOne': |
143 | - if (! method_exists($related_model, $relation_method)) { |
|
143 | + if (!method_exists($related_model, $relation_method)) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
147 | 147 | $related_entry = $related_model->{$relation_method}; |
148 | 148 | |
149 | - if (! $related_entry) { |
|
149 | + if (!$related_entry) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $name = is_string($subfield) ? $subfield : $subfield['name']; |
163 | 163 | // if the subfield name does not contain a dot we just need to check |
164 | 164 | // if it has subfields and return the result accordingly. |
165 | - if (! Str::contains($name, '.')) { |
|
165 | + if (!Str::contains($name, '.')) { |
|
166 | 166 | // when subfields are present, $related_entry->{$name} returns a model instance |
167 | 167 | // otherwise returns the model attribute. |
168 | 168 | if (isset($subfield['subfields'])) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $iterator = $iterator->$part; |
180 | 180 | } |
181 | 181 | |
182 | - Arr::set($result, $name, (! is_string($iterator) ? $iterator->getAttributes() : $iterator)); |
|
182 | + Arr::set($result, $name, (!is_string($iterator) ? $iterator->getAttributes() : $iterator)); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | $relation_array = explode('.', $relational_entity); |
203 | 203 | |
204 | - $related_model = array_reduce(array_splice($relation_array, 0, -1), function ($obj, $method) { |
|
204 | + $related_model = array_reduce(array_splice($relation_array, 0, -1), function($obj, $method) { |
|
205 | 205 | $method = Str::endsWith($method, '_id') ? Str::replaceLast('_id', '', $method) : $method; |
206 | 206 | |
207 | 207 | return $obj->{$method} ? $obj->{$method} : $obj; |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | */ |
97 | 97 | private function createRelationsForItem($item, $formattedRelations) |
98 | 98 | { |
99 | - if (! isset($formattedRelations['relations'])) { |
|
99 | + if (!isset($formattedRelations['relations'])) { |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | foreach ($formattedRelations['relations'] as $relationMethod => $relationDetails) { |
103 | - if (! isset($relationDetails['model'])) { |
|
103 | + if (!isset($relationDetails['model'])) { |
|
104 | 104 | continue; |
105 | 105 | } |
106 | 106 | $relation = $item->{$relationMethod}(); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | // - a single dimensional array: [1,2,3] |
125 | 125 | // - an array of arrays: [[1][2][3]] |
126 | 126 | // if is as single dimensional array we can only attach. |
127 | - if ($relationValues === null || ! is_multidimensional_array($relationValues)) { |
|
127 | + if ($relationValues === null || !is_multidimensional_array($relationValues)) { |
|
128 | 128 | $this->attachManyRelation($item, $relation, $relationDetails, $relationValues); |
129 | 129 | } else { |
130 | 130 | $this->createManyEntries($item, $relation, $relationMethod, $relationDetails); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | // if there is no relation data, and the values array is single dimensional we have |
148 | 148 | // an array of keys with no aditional pivot data. sync those. |
149 | - if (empty($relationValues) && ! is_multidimensional_array($values)) { |
|
149 | + if (empty($relationValues) && !is_multidimensional_array($values)) { |
|
150 | 150 | $relationValues = array_values($values); |
151 | 151 | } |
152 | 152 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | return $removed_entries->delete(); |
225 | 225 | } |
226 | 226 | |
227 | - if (! $relation_column_is_nullable && $model_instance->dbColumnHasDefault($relation_foreign_key)) { |
|
227 | + if (!$relation_column_is_nullable && $model_instance->dbColumnHasDefault($relation_foreign_key)) { |
|
228 | 228 | return $removed_entries->update([$relation_foreign_key => $model_instance->getDbColumnDefault($relation_foreign_key)]); |
229 | 229 | } |
230 | 230 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $created_ids = []; |
248 | 248 | |
249 | 249 | foreach ($items as $item) { |
250 | - if (isset($item[$relation_local_key]) && ! empty($item[$relation_local_key])) { |
|
250 | + if (isset($item[$relation_local_key]) && !empty($item[$relation_local_key])) { |
|
251 | 251 | $entry->{$relationMethod}()->where($relation_local_key, $item[$relation_local_key])->update(Arr::except($item, $relation_local_key)); |
252 | 252 | } else { |
253 | 253 | $created_ids[] = $entry->{$relationMethod}()->create($item)->{$relation_local_key}; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | // get from $items the sent ids, and merge the ones created. |
258 | 258 | $relatedItemsSent = array_merge(array_filter(Arr::pluck($items, $relation_local_key)), $created_ids); |
259 | 259 | |
260 | - if (! empty($relatedItemsSent)) { |
|
260 | + if (!empty($relatedItemsSent)) { |
|
261 | 261 | // we perform the cleanup of removed database items |
262 | 262 | $entry->{$relationMethod}()->whereNotIn($relation_local_key, $relatedItemsSent)->delete(); |
263 | 263 | } |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | $relationFields = $this->getRelationFields(); |
288 | 288 | |
289 | 289 | // exclude the already attached belongs to relations in the main entry but include nested belongs to. |
290 | - $relationFields = Arr::where($relationFields, function ($field, $key) { |
|
290 | + $relationFields = Arr::where($relationFields, function($field, $key) { |
|
291 | 291 | return $field['relation_type'] !== 'BelongsTo' || ($field['relation_type'] === 'BelongsTo' && Str::contains($field['name'], '.')); |
292 | 292 | }); |
293 | 293 | |
294 | 294 | //remove fields that are not in the submitted form input |
295 | - $relationFields = array_filter($relationFields, function ($field) use ($input) { |
|
295 | + $relationFields = array_filter($relationFields, function($field) use ($input) { |
|
296 | 296 | return Arr::has($input, $field['name']); |
297 | 297 | }); |
298 | 298 | |
@@ -325,11 +325,11 @@ discard block |
||
325 | 325 | $relationEntity = $field['entity']; |
326 | 326 | $attributeName = (string) Str::of($field['name'])->afterLast('.'); |
327 | 327 | |
328 | - if (! $parent) { |
|
328 | + if (!$parent) { |
|
329 | 329 | $key = implode('.relations.', explode('.', $this->getOnlyRelationEntity($field))); |
330 | 330 | $fieldDetails = Arr::get($relationDetails, 'relations.'.$key, []); |
331 | 331 | if ($field['relation_type'] === 'HasOne' || $field['relation_type'] === 'MorphOne') { |
332 | - if (! isset($field['subfields'])) { |
|
332 | + if (!isset($field['subfields'])) { |
|
333 | 333 | $fieldDetails['values'][$attributeName] = is_array(Arr::get($input, $relationEntity)) ? current(Arr::get($input, $relationEntity)) : Arr::get($input, $relationEntity); |
334 | 334 | } else { |
335 | 335 | $fieldDetails['values'] = is_array(Arr::get($input, $relationEntity)) ? current(Arr::get($input, $relationEntity)) : Arr::get($input, $relationEntity); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | return $relationDetails; |
348 | 348 | } |
349 | 349 | } |
350 | - if (! isset($fieldDetails['values'])) { |
|
350 | + if (!isset($fieldDetails['values'])) { |
|
351 | 351 | $fieldDetails['values'] = Arr::get($input, $relationEntity); |
352 | 352 | } |
353 | 353 | } else { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $subfield = ['name' => $subfield]; |
65 | 65 | } |
66 | 66 | |
67 | - if (! isset($field['model'])) { |
|
67 | + if (!isset($field['model'])) { |
|
68 | 68 | // we're inside a simple 'repeatable' with no model/relationship, so |
69 | 69 | // we assume all subfields are supposed to be text fields |
70 | 70 | $subfield['type'] = $subfield['type'] ?? 'text'; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function afterField($targetFieldName) |
142 | 142 | { |
143 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
143 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
144 | 144 | return $this->moveField($fields, $targetFieldName, false); |
145 | 145 | }); |
146 | 146 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function beforeField($targetFieldName) |
154 | 154 | { |
155 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
155 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
156 | 156 | return $this->moveField($fields, $targetFieldName, true); |
157 | 157 | }); |
158 | 158 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function makeFirstField() |
166 | 166 | { |
167 | - if (! $this->fields()) { |
|
167 | + if (!$this->fields()) { |
|
168 | 168 | return false; |
169 | 169 | } |
170 | 170 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function removeField($name) |
181 | 181 | { |
182 | - $this->transformFields(function ($fields) use ($name) { |
|
182 | + $this->transformFields(function($fields) use ($name) { |
|
183 | 183 | Arr::forget($fields, $name); |
184 | 184 | |
185 | 185 | return $fields; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function removeFields($array_of_names) |
195 | 195 | { |
196 | - if (! empty($array_of_names)) { |
|
196 | + if (!empty($array_of_names)) { |
|
197 | 197 | foreach ($array_of_names as $name) { |
198 | 198 | $this->removeField($name); |
199 | 199 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | public function removeAllFields() |
207 | 207 | { |
208 | 208 | $current_fields = $this->getCleanStateFields(); |
209 | - if (! empty($current_fields)) { |
|
209 | + if (!empty($current_fields)) { |
|
210 | 210 | foreach ($current_fields as $field) { |
211 | 211 | $this->removeField($field['name']); |
212 | 212 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $jsonCastables = ['array', 'object', 'json']; |
299 | 299 | $fieldCasting = $casted_attributes[$field['name']]; |
300 | 300 | |
301 | - if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && ! empty($data[$field['name']]) && ! is_array($data[$field['name']])) { |
|
301 | + if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && !empty($data[$field['name']]) && !is_array($data[$field['name']])) { |
|
302 | 302 | try { |
303 | 303 | $data[$field['name']] = json_decode($data[$field['name']]); |
304 | 304 | } catch (\Exception $e) { |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public function orderFields($order) |
329 | 329 | { |
330 | - $this->transformFields(function ($fields) use ($order) { |
|
330 | + $this->transformFields(function($fields) use ($order) { |
|
331 | 331 | return $this->applyOrderToFields($fields, $order); |
332 | 332 | }); |
333 | 333 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | public function hasUploadFields() |
354 | 354 | { |
355 | 355 | $fields = $this->getCleanStateFields(); |
356 | - $upload_fields = Arr::where($fields, function ($value, $key) { |
|
356 | + $upload_fields = Arr::where($fields, function($value, $key) { |
|
357 | 357 | return isset($value['upload']) && $value['upload'] == true; |
358 | 358 | }); |
359 | 359 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $alreadyLoaded = $this->getLoadedFieldTypes(); |
417 | 417 | $type = $this->getFieldTypeWithNamespace($field); |
418 | 418 | |
419 | - if (! in_array($type, $this->getLoadedFieldTypes(), true)) { |
|
419 | + if (!in_array($type, $this->getLoadedFieldTypes(), true)) { |
|
420 | 420 | $alreadyLoaded[] = $type; |
421 | 421 | $this->setLoadedFieldTypes($alreadyLoaded); |
422 | 422 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | */ |
458 | 458 | public function fieldTypeNotLoaded($field) |
459 | 459 | { |
460 | - return ! in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes()); |
|
460 | + return !in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes()); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | /** |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | */ |
498 | 498 | public function hasFieldWhere($attribute, $value) |
499 | 499 | { |
500 | - $match = Arr::first($this->getCleanStateFields(), function ($field, $fieldKey) use ($attribute, $value) { |
|
500 | + $match = Arr::first($this->getCleanStateFields(), function($field, $fieldKey) use ($attribute, $value) { |
|
501 | 501 | return isset($field[$attribute]) && $field[$attribute] == $value; |
502 | 502 | }); |
503 | 503 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | */ |
514 | 514 | public function firstFieldWhere($attribute, $value) |
515 | 515 | { |
516 | - return Arr::first($this->getCleanStateFields(), function ($field, $fieldKey) use ($attribute, $value) { |
|
516 | + return Arr::first($this->getCleanStateFields(), function($field, $fieldKey) use ($attribute, $value) { |
|
517 | 517 | return isset($field[$attribute]) && $field[$attribute] == $value; |
518 | 518 | }); |
519 | 519 | } |