We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | if(isset($data[$relation])){ |
| 123 | 123 | $model->{$relation}()->sync($data[$relation]); |
| 124 | 124 | }else{ |
| 125 | - $model->{$relation}()->sync([]); |
|
| 125 | + $model->{$relation}()->sync([]); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | }else{ |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | if( isset($relation['pivotFields']) ){ |
| 133 | 133 | foreach($relation['pivotFields'] as $pivotField){ |
| 134 | - foreach($data[$pivotField] as $pivot_id => $field){ |
|
| 135 | - $model->{$relation['name']}()->updateExistingPivot($pivot_id, [$pivotField => $field]); |
|
| 136 | - } |
|
| 134 | + foreach($data[$pivotField] as $pivot_id => $field){ |
|
| 135 | + $model->{$relation['name']}()->updateExistingPivot($pivot_id, [$pivotField => $field]); |
|
| 136 | + } |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
| 178 | - /* |
|
| 178 | + /* |
|
| 179 | 179 | |-------------------------------------------------------------------------- |
| 180 | 180 | | READ |
| 181 | 181 | |-------------------------------------------------------------------------- |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | |
| 259 | 259 | |
| 260 | - /* |
|
| 260 | + /* |
|
| 261 | 261 | |-------------------------------------------------------------------------- |
| 262 | 262 | | UPDATE |
| 263 | 263 | |-------------------------------------------------------------------------- |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | |
| 324 | 324 | |
| 325 | - /* |
|
| 325 | + /* |
|
| 326 | 326 | |-------------------------------------------------------------------------- |
| 327 | 327 | | DELETE |
| 328 | 328 | |-------------------------------------------------------------------------- |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | |
| 415 | 415 | |
| 416 | - /* |
|
| 416 | + /* |
|
| 417 | 417 | |-------------------------------------------------------------------------- |
| 418 | 418 | | CRUD ACCESS |
| 419 | 419 | |-------------------------------------------------------------------------- |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | |
| 843 | 843 | if (!in_array($field, $this->model->getHidden())) |
| 844 | 844 | { |
| 845 | - $this->columns[] = [ |
|
| 845 | + $this->columns[] = [ |
|
| 846 | 846 | 'name' => $field, |
| 847 | 847 | 'label' => ucfirst($field), |
| 848 | 848 | 'type' => $this->getFieldTypeFromDbColumnType($field) |
@@ -1210,10 +1210,10 @@ discard block |
||
| 1210 | 1210 | |
| 1211 | 1211 | public function addCreateField($field) |
| 1212 | 1212 | { |
| 1213 | - return $this->add('create_fields', $field); |
|
| 1213 | + return $this->add('create_fields', $field); |
|
| 1214 | 1214 | } |
| 1215 | 1215 | |
| 1216 | - public function setUpdateFields($fields) |
|
| 1216 | + public function setUpdateFields($fields) |
|
| 1217 | 1217 | { |
| 1218 | 1218 | $this->addMultiple('update_fields', $fields); |
| 1219 | 1219 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function getCreateFields() |
| 82 | 82 | { |
| 83 | - return $this->prepareFields(empty($this->create_fields)?$this->fields:$this->create_fields); |
|
| 83 | + return $this->prepareFields(empty($this->create_fields) ? $this->fields : $this->create_fields); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function getRelationFields($form = 'create') |
| 93 | 93 | { |
| 94 | - if( $form == 'create' ){ |
|
| 95 | - $fields = empty($this->create_fields)?$this->fields:$this->create_fields; |
|
| 96 | - }else{ |
|
| 97 | - $fields = empty($this->update_fields)?$this->fields:$this->update_fields; |
|
| 94 | + if ($form == 'create') { |
|
| 95 | + $fields = empty($this->create_fields) ? $this->fields : $this->create_fields; |
|
| 96 | + } else { |
|
| 97 | + $fields = empty($this->update_fields) ? $this->fields : $this->update_fields; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $relationFields = []; |
| 101 | 101 | |
| 102 | - foreach($fields as $field){ |
|
| 103 | - if(isset($field['model']) || isset($field['dependencies'])){ |
|
| 102 | + foreach ($fields as $field) { |
|
| 103 | + if (isset($field['model']) || isset($field['dependencies'])) { |
|
| 104 | 104 | array_push($relationFields, $field); |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -116,22 +116,22 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | foreach ($relations as $key => $relation) |
| 118 | 118 | { |
| 119 | - if ( (isset($relation['pivot']) && $relation['pivot'] ) || isset($relation['dependencies']) ){ |
|
| 120 | - if(is_array($relation['name'])){ |
|
| 121 | - foreach($relation['name'] as $relation){ |
|
| 122 | - if(isset($data[$relation])){ |
|
| 119 | + if ((isset($relation['pivot']) && $relation['pivot']) || isset($relation['dependencies'])) { |
|
| 120 | + if (is_array($relation['name'])) { |
|
| 121 | + foreach ($relation['name'] as $relation) { |
|
| 122 | + if (isset($data[$relation])) { |
|
| 123 | 123 | $model->{$relation}()->sync($data[$relation]); |
| 124 | - }else{ |
|
| 124 | + } else { |
|
| 125 | 125 | $model->{$relation}()->sync([]); |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | - }else{ |
|
| 128 | + } else { |
|
| 129 | 129 | $model->{$relation['name']}()->sync($data[$relation['name']]); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if( isset($relation['pivotFields']) ){ |
|
| 133 | - foreach($relation['pivotFields'] as $pivotField){ |
|
| 134 | - foreach($data[$pivotField] as $pivot_id => $field){ |
|
| 132 | + if (isset($relation['pivotFields'])) { |
|
| 133 | + foreach ($relation['pivotFields'] as $pivotField) { |
|
| 134 | + foreach ($data[$pivotField] as $pivot_id => $field) { |
|
| 135 | 135 | $model->{$relation['name']}()->updateExistingPivot($pivot_id, [$pivotField => $field]); |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -289,21 +289,21 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function getUpdateFields($id) |
| 291 | 291 | { |
| 292 | - $fields = $this->prepareFields(empty($this->update_fields)?$this->fields:$this->update_fields); |
|
| 292 | + $fields = $this->prepareFields(empty($this->update_fields) ? $this->fields : $this->update_fields); |
|
| 293 | 293 | $entry = $this->getEntry($id); |
| 294 | 294 | |
| 295 | 295 | foreach ($fields as $k => $field) { |
| 296 | 296 | // set the value |
| 297 | 297 | if (!isset($fields[$k]['value'])) |
| 298 | 298 | { |
| 299 | - if(is_array($field['name'])){ |
|
| 299 | + if (is_array($field['name'])) { |
|
| 300 | 300 | |
| 301 | 301 | $fields[$k]['value'] = []; |
| 302 | - foreach($field['name'] as $key => $relation){ |
|
| 302 | + foreach ($field['name'] as $key => $relation) { |
|
| 303 | 303 | $fields[$k]['value'][] = $entry->{$relation}; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - }else{ |
|
| 306 | + } else { |
|
| 307 | 307 | $fields[$k]['value'] = $entry->{$field['name']}; |
| 308 | 308 | } |
| 309 | 309 | } |
@@ -422,13 +422,13 @@ discard block |
||
| 422 | 422 | public function allowAccess($access) |
| 423 | 423 | { |
| 424 | 424 | // $this->addButtons((array)$access); |
| 425 | - return $this->access = array_merge(array_diff((array)$access, $this->access), $this->access); |
|
| 425 | + return $this->access = array_merge(array_diff((array) $access, $this->access), $this->access); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | public function denyAccess($access) |
| 429 | 429 | { |
| 430 | 430 | // $this->removeButtons((array)$access); |
| 431 | - return $this->access = array_diff($this->access, (array)$access); |
|
| 431 | + return $this->access = array_diff($this->access, (array) $access); |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | /** |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | */ |
| 642 | 642 | public function addDefaultTypeToColumn($column) |
| 643 | 643 | { |
| 644 | - if (array_key_exists('name', (array)$column)) |
|
| 644 | + if (array_key_exists('name', (array) $column)) |
|
| 645 | 645 | { |
| 646 | 646 | $default_type = $this->getFieldTypeFromDbColumnType($column['name']); |
| 647 | 647 | return array_merge(['type' => $default_type], $column); |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | * @param [field or column] |
| 658 | 658 | */ |
| 659 | 659 | public function addDefaultLabel($array) { |
| 660 | - if (!array_key_exists('label', (array)$array) && array_key_exists('name', (array)$array)) { |
|
| 660 | + if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
| 661 | 661 | $array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array); |
| 662 | 662 | return $array; |
| 663 | 663 | } |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | array_map(function($field) { |
| 832 | 832 | // $this->labels[$field] = $this->makeLabel($field); |
| 833 | 833 | |
| 834 | - $this->fields[] = [ |
|
| 834 | + $this->fields[] = [ |
|
| 835 | 835 | 'name' => $field, |
| 836 | 836 | 'label' => ucfirst($field), |
| 837 | 837 | 'value' => '', 'default' => $this->field_types[$field]['default'], |
@@ -1173,7 +1173,7 @@ discard block |
||
| 1173 | 1173 | |
| 1174 | 1174 | public function orderColumns($order) |
| 1175 | 1175 | { |
| 1176 | - $this->setSort('columns', (array)$order); |
|
| 1176 | + $this->setSort('columns', (array) $order); |
|
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | |
@@ -1248,13 +1248,13 @@ discard block |
||
| 1248 | 1248 | |
| 1249 | 1249 | public function orderFields($order) |
| 1250 | 1250 | { |
| 1251 | - $this->setSort('fields', (array)$order); |
|
| 1251 | + $this->setSort('fields', (array) $order); |
|
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | 1254 | |
| 1255 | 1255 | public function syncField($field) |
| 1256 | 1256 | { |
| 1257 | - if (array_key_exists('name', (array)$field)) return array_merge(['type' => $this->getFieldTypeFromDbColumnType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field); |
|
| 1257 | + if (array_key_exists('name', (array) $field)) return array_merge(['type' => $this->getFieldTypeFromDbColumnType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field); |
|
| 1258 | 1258 | |
| 1259 | 1259 | return false; |
| 1260 | 1260 | } |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | if (!empty($this->{$type})) |
| 1294 | 1294 | { |
| 1295 | 1295 | $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
| 1296 | - if (in_array($field['name'], (array)$fields)) $field = array_merge($field, $attributes); |
|
| 1296 | + if (in_array($field['name'], (array) $fields)) $field = array_merge($field, $attributes); |
|
| 1297 | 1297 | |
| 1298 | 1298 | return $field; |
| 1299 | 1299 | }, $this->{$type}); |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | |
| 1305 | 1305 | public function remove($entity, $fields) |
| 1306 | 1306 | { |
| 1307 | - return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array)$fields);})); |
|
| 1307 | + return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array) $fields); })); |
|
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | public function setSort($items, $order) |
@@ -1323,7 +1323,7 @@ discard block |
||
| 1323 | 1323 | if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) $elements[] = $this->{$items}[$key]; |
| 1324 | 1324 | } |
| 1325 | 1325 | |
| 1326 | - return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]);})); |
|
| 1326 | + return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]); })); |
|
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | return $this->{$items}; |
@@ -1336,7 +1336,7 @@ discard block |
||
| 1336 | 1336 | // cred ca ia valorile din tabela de legatura ca sa ti le afiseze in select |
| 1337 | 1337 | public function getRelationValues($model, $field, $where = [], $order = []) |
| 1338 | 1338 | { |
| 1339 | - $order = (array)$order; |
|
| 1339 | + $order = (array) $order; |
|
| 1340 | 1340 | $values = $model->select('*'); |
| 1341 | 1341 | |
| 1342 | 1342 | if (!empty($where)) call_user_func_array([$values, $where[0]], array_slice($where, 1)); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | if( $form == 'create' ){ |
| 95 | 95 | $fields = empty($this->create_fields)?$this->fields:$this->create_fields; |
| 96 | - }else{ |
|
| 96 | + } else{ |
|
| 97 | 97 | $fields = empty($this->update_fields)?$this->fields:$this->update_fields; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -121,11 +121,11 @@ discard block |
||
| 121 | 121 | foreach($relation['name'] as $relation){ |
| 122 | 122 | if(isset($data[$relation])){ |
| 123 | 123 | $model->{$relation}()->sync($data[$relation]); |
| 124 | - }else{ |
|
| 124 | + } else{ |
|
| 125 | 125 | $model->{$relation}()->sync([]); |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | - }else{ |
|
| 128 | + } else{ |
|
| 129 | 129 | $model->{$relation['name']}()->sync($data[$relation['name']]); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $fields[$k]['value'][] = $entry->{$relation}; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - }else{ |
|
| 306 | + } else{ |
|
| 307 | 307 | $fields[$k]['value'] = $entry->{$field['name']}; |
| 308 | 308 | } |
| 309 | 309 | } |
@@ -482,7 +482,9 @@ discard block |
||
| 482 | 482 | */ |
| 483 | 483 | public function setModel($model_namespace) |
| 484 | 484 | { |
| 485 | - if (!class_exists($model_namespace)) throw new \Exception('This model does not exist.', 404); |
|
| 485 | + if (!class_exists($model_namespace)) { |
|
| 486 | + throw new \Exception('This model does not exist.', 404); |
|
| 487 | + } |
|
| 486 | 488 | |
| 487 | 489 | $this->model = new $model_namespace(); |
| 488 | 490 | $this->query = $this->model->select('*'); |
@@ -524,7 +526,9 @@ discard block |
||
| 524 | 526 | { |
| 525 | 527 | $complete_route = $route.'.index'; |
| 526 | 528 | |
| 527 | - if (!\Route::has($complete_route)) throw new \Exception('There are no routes for this route name.', 404); |
|
| 529 | + if (!\Route::has($complete_route)) { |
|
| 530 | + throw new \Exception('There are no routes for this route name.', 404); |
|
| 531 | + } |
|
| 528 | 532 | |
| 529 | 533 | $this->route = route($complete_route, $parameters); |
| 530 | 534 | $this->initButtons(); |
@@ -580,8 +584,7 @@ discard block |
||
| 580 | 584 | // if label and other details have been defined in the array |
| 581 | 585 | if (is_array($columns[0])) { |
| 582 | 586 | $this->addColumn($column); |
| 583 | - } |
|
| 584 | - else |
|
| 587 | + } else |
|
| 585 | 588 | { |
| 586 | 589 | $this->addColumn([ |
| 587 | 590 | 'name' => $column, |
@@ -877,11 +880,17 @@ discard block |
||
| 877 | 880 | */ |
| 878 | 881 | public function getFieldTypeFromDbColumnType($field) |
| 879 | 882 | { |
| 880 | - if (!array_key_exists($field, $this->field_types)) return 'text'; |
|
| 883 | + if (!array_key_exists($field, $this->field_types)) { |
|
| 884 | + return 'text'; |
|
| 885 | + } |
|
| 881 | 886 | |
| 882 | - if ($field == 'password') return 'password'; |
|
| 887 | + if ($field == 'password') { |
|
| 888 | + return 'password'; |
|
| 889 | + } |
|
| 883 | 890 | |
| 884 | - if ($field == 'email') return 'email'; |
|
| 891 | + if ($field == 'email') { |
|
| 892 | + return 'email'; |
|
| 893 | + } |
|
| 885 | 894 | |
| 886 | 895 | switch ($this->field_types[$field]['type']) |
| 887 | 896 | { |
@@ -954,7 +963,9 @@ discard block |
||
| 954 | 963 | $columns = \Schema::getColumnListing($this->model->getTable()); |
| 955 | 964 | $fillable = $this->model->getFillable(); |
| 956 | 965 | |
| 957 | - if (!empty($fillable)) $columns = array_intersect($columns, $fillable); |
|
| 966 | + if (!empty($fillable)) { |
|
| 967 | + $columns = array_intersect($columns, $fillable); |
|
| 968 | + } |
|
| 958 | 969 | |
| 959 | 970 | // but not updated_at, deleted_at |
| 960 | 971 | return array_values(array_diff($columns, [$this->model->getKeyName(), 'updated_at', 'deleted_at'])); |
@@ -1254,7 +1265,9 @@ discard block |
||
| 1254 | 1265 | |
| 1255 | 1266 | public function syncField($field) |
| 1256 | 1267 | { |
| 1257 | - if (array_key_exists('name', (array)$field)) return array_merge(['type' => $this->getFieldTypeFromDbColumnType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field); |
|
| 1268 | + if (array_key_exists('name', (array)$field)) { |
|
| 1269 | + return array_merge(['type' => $this->getFieldTypeFromDbColumnType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field); |
|
| 1270 | + } |
|
| 1258 | 1271 | |
| 1259 | 1272 | return false; |
| 1260 | 1273 | } |
@@ -1272,8 +1285,11 @@ discard block |
||
| 1272 | 1285 | |
| 1273 | 1286 | foreach ($this->{$fields} as $key => $field) |
| 1274 | 1287 | { |
| 1275 | - if (array_key_exists($field['name'], $this->relations) && $this->relations[$field['name']]['pivot']) $this->{$fields}[$key]['value'] = $this->entry->{$this->relations[$field['name']]['name']}()->lists($this->relations[$field['name']]['model']->getKeyName())->toArray(); |
|
| 1276 | - else $this->{$fields}[$key]['value'] = $this->entry->{$field['name']}; |
|
| 1288 | + if (array_key_exists($field['name'], $this->relations) && $this->relations[$field['name']]['pivot']) { |
|
| 1289 | + $this->{$fields}[$key]['value'] = $this->entry->{$this->relations[$field['name']]['name']}()->lists($this->relations[$field['name']]['model']->getKeyName())->toArray(); |
|
| 1290 | + } else { |
|
| 1291 | + $this->{$fields}[$key]['value'] = $this->entry->{$field['name']}; |
|
| 1292 | + } |
|
| 1277 | 1293 | } |
| 1278 | 1294 | } |
| 1279 | 1295 | } |
@@ -1293,7 +1309,9 @@ discard block |
||
| 1293 | 1309 | if (!empty($this->{$type})) |
| 1294 | 1310 | { |
| 1295 | 1311 | $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
| 1296 | - if (in_array($field['name'], (array)$fields)) $field = array_merge($field, $attributes); |
|
| 1312 | + if (in_array($field['name'], (array)$fields)) { |
|
| 1313 | + $field = array_merge($field, $attributes); |
|
| 1314 | + } |
|
| 1297 | 1315 | |
| 1298 | 1316 | return $field; |
| 1299 | 1317 | }, $this->{$type}); |
@@ -1320,7 +1338,9 @@ discard block |
||
| 1320 | 1338 | |
| 1321 | 1339 | foreach ($this->sort[$items] as $item) |
| 1322 | 1340 | { |
| 1323 | - if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) $elements[] = $this->{$items}[$key]; |
|
| 1341 | + if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) { |
|
| 1342 | + $elements[] = $this->{$items}[$key]; |
|
| 1343 | + } |
|
| 1324 | 1344 | } |
| 1325 | 1345 | |
| 1326 | 1346 | return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]);})); |
@@ -1339,9 +1359,13 @@ discard block |
||
| 1339 | 1359 | $order = (array)$order; |
| 1340 | 1360 | $values = $model->select('*'); |
| 1341 | 1361 | |
| 1342 | - if (!empty($where)) call_user_func_array([$values, $where[0]], array_slice($where, 1)); |
|
| 1362 | + if (!empty($where)) { |
|
| 1363 | + call_user_func_array([$values, $where[0]], array_slice($where, 1)); |
|
| 1364 | + } |
|
| 1343 | 1365 | |
| 1344 | - if (!empty($order)) call_user_func_array([$values, 'orderBy'], $order); |
|
| 1366 | + if (!empty($order)) { |
|
| 1367 | + call_user_func_array([$values, 'orderBy'], $order); |
|
| 1368 | + } |
|
| 1345 | 1369 | |
| 1346 | 1370 | return $values->get()->lists($field, $model->getKeyName())->toArray(); |
| 1347 | 1371 | } |
@@ -1350,8 +1374,11 @@ discard block |
||
| 1350 | 1374 | public function syncRelations($entity) |
| 1351 | 1375 | { |
| 1352 | 1376 | foreach ($this->relations as $field => $relation) { |
| 1353 | - if ($relation['pivot']) $this->add($entity, ['name' => $field, 'type' => 'multiselect', 'value' => [], 'values' => $this->relations[$field]['values']]); |
|
| 1354 | - else $this->sync($entity, $field, ['type' => 'select', 'values' => $this->relations[$field]['values']]); |
|
| 1377 | + if ($relation['pivot']) { |
|
| 1378 | + $this->add($entity, ['name' => $field, 'type' => 'multiselect', 'value' => [], 'values' => $this->relations[$field]['values']]); |
|
| 1379 | + } else { |
|
| 1380 | + $this->sync($entity, $field, ['type' => 'select', 'values' => $this->relations[$field]['values']]); |
|
| 1381 | + } |
|
| 1355 | 1382 | } |
| 1356 | 1383 | } |
| 1357 | 1384 | |