We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -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,38 +44,38 @@ 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 | }); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | [$conn, $table] = self::getConnectionAndTable(); |
68 | 68 | |
69 | 69 | // MongoDB columns are alway nullable |
70 | - if (! in_array($conn->getConfig()['driver'], CRUD::getSqlDriverList())) { |
|
70 | + if (!in_array($conn->getConfig()['driver'], CRUD::getSqlDriverList())) { |
|
71 | 71 | return true; |
72 | 72 | } |
73 | 73 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | // check for NOT NULL |
78 | 78 | $notNull = $column->getNotnull(); |
79 | 79 | // return the value of nullable (aka the inverse of NOT NULL) |
80 | - return ! $notNull; |
|
80 | + return !$notNull; |
|
81 | 81 | } catch (\Exception $e) { |
82 | 82 | return true; |
83 | 83 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | [$conn, $table] = self::getConnectionAndTable(); |
95 | 95 | |
96 | 96 | // MongoDB columns don't have default values |
97 | - if (! in_array($conn->getConfig()['driver'], CRUD::getSqlDriverList())) { |
|
97 | + if (!in_array($conn->getConfig()['driver'], CRUD::getSqlDriverList())) { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | // construct the validation rules array |
30 | 30 | // (eg. ['name' => 'required|min:2']) |
31 | 31 | $rules = collect($fields) |
32 | - ->filter(function ($value, $key) { |
|
32 | + ->filter(function($value, $key) { |
|
33 | 33 | // only keep fields where 'validationRules' attribute is defined |
34 | 34 | return array_key_exists('validationRules', $value); |
35 | - })->map(function ($item, $key) { |
|
35 | + })->map(function($item, $key) { |
|
36 | 36 | // only keep the rules, not the entire field definition |
37 | 37 | return $item['validationRules']; |
38 | 38 | })->toArray(); |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | // (eg. ['title.required' => 'You gotta write smth man.']) |
42 | 42 | $messages = []; |
43 | 43 | collect($fields) |
44 | - ->filter(function ($value, $key) { |
|
44 | + ->filter(function($value, $key) { |
|
45 | 45 | // only keep fields where 'validationMessages' attribute is defined |
46 | 46 | return array_key_exists('validationMessages', $value); |
47 | - })->each(function ($item, $key) use (&$messages) { |
|
47 | + })->each(function($item, $key) use (&$messages) { |
|
48 | 48 | foreach ($item['validationMessages'] as $rule => $message) { |
49 | 49 | $messages[$key.'.'.$rule] = $message; |
50 | 50 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function setValidation($classOrRulesArray = false, $messages = []) |
76 | 76 | { |
77 | - if (! $classOrRulesArray) { |
|
77 | + if (!$classOrRulesArray) { |
|
78 | 78 | $this->setValidationFromFields(); |
79 | 79 | } elseif (is_array($classOrRulesArray)) { |
80 | 80 | $this->setValidationFromArray($classOrRulesArray, $messages); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function isRequired($inputKey) |
204 | 204 | { |
205 | - if (! $this->hasOperationSetting('requiredFields')) { |
|
205 | + if (!$this->hasOperationSetting('requiredFields')) { |
|
206 | 206 | return false; |
207 | 207 | } |
208 | 208 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $fields_with_pivot = $this->getRelationFieldsWithPivot(); |
102 | 102 | |
103 | 103 | //remove fields that are not in the submitted form input |
104 | - $fields_with_pivot = array_filter($fields_with_pivot, function ($item) use ($input) { |
|
104 | + $fields_with_pivot = array_filter($fields_with_pivot, function($item) use ($input) { |
|
105 | 105 | return Arr::has($input, $item['name']); |
106 | 106 | }); |
107 | 107 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | */ |
157 | 157 | private function createRelationsForItem($item, $formattedRelations) |
158 | 158 | { |
159 | - if (! isset($formattedRelations['relations'])) { |
|
159 | + if (!isset($formattedRelations['relations'])) { |
|
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | foreach ($formattedRelations['relations'] as $relationMethod => $relationDetails) { |
163 | - if (! isset($relationDetails['model'])) { |
|
163 | + if (!isset($relationDetails['model'])) { |
|
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | $model = $relationDetails['model']; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | return $removed_entries->delete(); |
244 | 244 | } |
245 | 245 | |
246 | - if (! $relation_column_is_nullable && $model_instance->dbColumnHasDefault($relation_foreign_key)) { |
|
246 | + if (!$relation_column_is_nullable && $model_instance->dbColumnHasDefault($relation_foreign_key)) { |
|
247 | 247 | return $removed_entries->update([$relation_foreign_key => $model_instance->getDbColumnDefault($relation_foreign_key)]); |
248 | 248 | } |
249 | 249 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $created_ids = []; |
267 | 267 | |
268 | 268 | foreach ($items as $item) { |
269 | - if (isset($item[$relation_local_key]) && ! empty($item[$relation_local_key])) { |
|
269 | + if (isset($item[$relation_local_key]) && !empty($item[$relation_local_key])) { |
|
270 | 270 | $entry->{$relationMethod}()->updateOrCreate([$relation_local_key => $item[$relation_local_key]], Arr::except($item, $relation_local_key)); |
271 | 271 | } else { |
272 | 272 | $created_ids[] = $entry->{$relationMethod}()->create($item)->{$relation_local_key}; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | // get from $items the sent ids, and merge the ones created. |
277 | 277 | $relatedItemsSent = array_merge(array_filter(Arr::pluck($items, $relation_local_key)), $created_ids); |
278 | 278 | |
279 | - if (! empty($relatedItemsSent)) { |
|
279 | + if (!empty($relatedItemsSent)) { |
|
280 | 280 | // we perform the cleanup of removed database items |
281 | 281 | $entry->{$relationMethod}()->whereNotIn($relation_local_key, $relatedItemsSent)->delete(); |
282 | 282 | } |
@@ -306,12 +306,12 @@ discard block |
||
306 | 306 | $relationFields = $this->getRelationFieldsWithoutPivot(); |
307 | 307 | |
308 | 308 | //remove fields that are not in the submitted form input |
309 | - $relationFields = array_filter($relationFields, function ($item) use ($input) { |
|
309 | + $relationFields = array_filter($relationFields, function($item) use ($input) { |
|
310 | 310 | return Arr::has($input, $item['name']); |
311 | 311 | }); |
312 | 312 | |
313 | 313 | // exclude the already attached belongs to relations in the main entry but include nested belongs to. |
314 | - $relationFields = Arr::where($relationFields, function ($field, $key) { |
|
314 | + $relationFields = Arr::where($relationFields, function($field, $key) { |
|
315 | 315 | return $field['relation_type'] !== 'BelongsTo' || ($field['relation_type'] === 'BelongsTo' && Str::contains($field['name'], '.')); |
316 | 316 | }); |
317 | 317 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <?php |
4 | 4 | $max = isset($field['max']) && (int) $field['max'] > 0 ? $field['max'] : -1; |
5 | 5 | $min = isset($field['min']) && (int) $field['min'] > 0 ? $field['min'] : -1; |
6 | - $item_name = strtolower(isset($field['entity_singular']) && ! empty($field['entity_singular']) ? $field['entity_singular'] : $field['label']); |
|
6 | + $item_name = strtolower(isset($field['entity_singular']) && !empty($field['entity_singular']) ? $field['entity_singular'] : $field['label']); |
|
7 | 7 | |
8 | 8 | $items = old_empty_or_null($field['name'], '') ?? $field['value'] ?? $field['default'] ?? ''; |
9 | 9 | |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | } else { |
16 | 16 | $items = '[]'; |
17 | 17 | } |
18 | - } elseif (is_string($items) && ! is_array(json_decode($items))) { |
|
18 | + } elseif (is_string($items) && !is_array(json_decode($items))) { |
|
19 | 19 | $items = '[]'; |
20 | 20 | } |
21 | 21 | |
22 | 22 | // make sure columns are defined |
23 | - if (! isset($field['columns'])) { |
|
23 | + if (!isset($field['columns'])) { |
|
24 | 24 | $field['columns'] = ['value' => 'Value']; |
25 | 25 | } |
26 | 26 |
@@ -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: |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function overwriteFieldNameFromDotNotationToArray($field) |
70 | 70 | { |
71 | - if (! is_array($field['name']) && strpos($field['name'], '.') !== false) { |
|
71 | + if (!is_array($field['name']) && strpos($field['name'], '.') !== false) { |
|
72 | 72 | $entity_array = explode('.', $field['name']); |
73 | 73 | $name_string = ''; |
74 | 74 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | return ['name' => $field]; |
111 | 111 | } |
112 | 112 | |
113 | - if (is_array($field) && ! isset($field['name'])) { |
|
113 | + if (is_array($field) && !isset($field['name'])) { |
|
114 | 114 | abort(500, 'All fields must have their name defined'); |
115 | 115 | } |
116 | 116 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | // if there's a model defined, but no attribute |
175 | 175 | // guess an attribute using the identifiableAttribute functionality in CrudTrait |
176 | - if (isset($field['model']) && ! isset($field['attribute']) && method_exists($field['model'], 'identifiableAttribute')) { |
|
176 | + if (isset($field['model']) && !isset($field['attribute']) && method_exists($field['model'], 'identifiableAttribute')) { |
|
177 | 177 | $field['attribute'] = call_user_func([(new $field['model']()), 'identifiableAttribute']); |
178 | 178 | } |
179 | 179 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | protected function makeSureFieldHasLabel($field) |
191 | 191 | { |
192 | - if (! isset($field['label'])) { |
|
192 | + if (!isset($field['label'])) { |
|
193 | 193 | $name = is_array($field['name']) ? $field['name'][0] : $field['name']; |
194 | 194 | $name = str_replace('_id', '', $name); |
195 | 195 | $field['label'] = mb_ucfirst(str_replace('_', ' ', $name)); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | protected function makeSureFieldHasType($field) |
209 | 209 | { |
210 | - if (! isset($field['type'])) { |
|
210 | + if (!isset($field['type'])) { |
|
211 | 211 | $field['type'] = isset($field['relation_type']) ? 'relationship' : $this->inferFieldTypeFromDbColumnType($field['name']); |
212 | 212 | } |
213 | 213 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | { |
225 | 225 | // if a tab was mentioned, we should enable it |
226 | 226 | if (isset($field['tab'])) { |
227 | - if (! $this->tabsEnabled()) { |
|
227 | + if (!$this->tabsEnabled()) { |
|
228 | 228 | $this->enableTabs(); |
229 | 229 | } |
230 | 230 | } |
@@ -33,35 +33,35 @@ |
||
33 | 33 | $old_primary_dependency = old_empty_or_null($primary_dependency['name'], false) ?? false; |
34 | 34 | $old_secondary_dependency = old_empty_or_null($secondary_dependency['name'], false) ?? false; |
35 | 35 | |
36 | - //for update form, get initial state of the entity |
|
37 | - if (isset($id) && $id) { |
|
36 | + //for update form, get initial state of the entity |
|
37 | + if (isset($id) && $id) { |
|
38 | 38 | |
39 | 39 | //get entity with relations for primary dependency |
40 | - $entity_dependencies = $entity_model->with($primary_dependency['entity']) |
|
41 | - ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary']) |
|
42 | - ->find($id); |
|
40 | + $entity_dependencies = $entity_model->with($primary_dependency['entity']) |
|
41 | + ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary']) |
|
42 | + ->find($id); |
|
43 | 43 | |
44 | - $secondaries_from_primary = []; |
|
44 | + $secondaries_from_primary = []; |
|
45 | 45 | |
46 | - //convert relation in array |
|
47 | - $primary_array = $entity_dependencies->{$primary_dependency['entity']}->toArray(); |
|
46 | + //convert relation in array |
|
47 | + $primary_array = $entity_dependencies->{$primary_dependency['entity']}->toArray(); |
|
48 | 48 | |
49 | - $secondary_ids = []; |
|
50 | - //create secondary dependency from primary relation, used to check what checkbox must be checked from second checklist |
|
51 | - if ($old_primary_dependency) { |
|
52 | - foreach ($old_primary_dependency as $primary_item) { |
|
53 | - foreach ($dependencyArray[$primary_item] as $second_item) { |
|
54 | - $secondary_ids[$second_item] = $second_item; |
|
55 | - } |
|
56 | - } |
|
57 | - } else { //create dependencies from relation if not from validate error |
|
58 | - foreach ($primary_array as $primary_item) { |
|
59 | - foreach ($primary_item[$secondary_dependency['entity']] as $second_item) { |
|
60 | - $secondary_ids[$second_item['id']] = $second_item['id']; |
|
61 | - } |
|
62 | - } |
|
63 | - } |
|
64 | - } |
|
49 | + $secondary_ids = []; |
|
50 | + //create secondary dependency from primary relation, used to check what checkbox must be checked from second checklist |
|
51 | + if ($old_primary_dependency) { |
|
52 | + foreach ($old_primary_dependency as $primary_item) { |
|
53 | + foreach ($dependencyArray[$primary_item] as $second_item) { |
|
54 | + $secondary_ids[$second_item] = $second_item; |
|
55 | + } |
|
56 | + } |
|
57 | + } else { //create dependencies from relation if not from validate error |
|
58 | + foreach ($primary_array as $primary_item) { |
|
59 | + foreach ($primary_item[$secondary_dependency['entity']] as $second_item) { |
|
60 | + $secondary_ids[$second_item['id']] = $second_item['id']; |
|
61 | + } |
|
62 | + } |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | //json encode of dependency matrix |
67 | 67 | $dependencyJson = json_encode($dependencyArray); |