We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -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)); |