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