We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | <!-- elFinder JS (REQUIRED) --> |
| 18 | 18 | <script src="<?= asset($dir.'/js/elfinder.min.js') ?>"></script> |
| 19 | 19 | |
| 20 | - <?php if($locale){ ?> |
|
| 20 | + <?php if ($locale) { ?> |
|
| 21 | 21 | <!-- elFinder translation (OPTIONAL) --> |
| 22 | 22 | <script src="<?= asset($dir."/js/i18n/elfinder.$locale.js") ?>"></script> |
| 23 | 23 | <?php } ?> |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $().ready(function() { |
| 41 | 41 | var elf = $('#elfinder').elfinder({ |
| 42 | 42 | // set your elFinder options here |
| 43 | - <?php if($locale){ ?> |
|
| 43 | + <?php if ($locale) { ?> |
|
| 44 | 44 | lang: '<?= $locale ?>', // locale |
| 45 | 45 | <?php } ?> |
| 46 | 46 | customData: { |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | <!-- elFinder JS (REQUIRED) --> |
| 18 | 18 | <script src="<?= asset($dir.'/js/elfinder.min.js') ?>"></script> |
| 19 | 19 | |
| 20 | - <?php if($locale){ ?> |
|
| 20 | + <?php if ($locale) { ?> |
|
| 21 | 21 | <!-- elFinder translation (OPTIONAL) --> |
| 22 | 22 | <script src="<?= asset($dir."/js/i18n/elfinder.$locale.js") ?>"></script> |
| 23 | 23 | <?php } ?> |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $().ready(function() { |
| 41 | 41 | var elf = $('#elfinder').elfinder({ |
| 42 | 42 | // set your elFinder options here |
| 43 | - <?php if($locale){ ?> |
|
| 43 | + <?php if ($locale) { ?> |
|
| 44 | 44 | lang: '<?= $locale ?>', // locale |
| 45 | 45 | <?php } ?> |
| 46 | 46 | customData: { |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | <!-- elFinder JS (REQUIRED) --> |
| 18 | 18 | <script src="<?= asset($dir.'/js/elfinder.min.js') ?>"></script> |
| 19 | 19 | |
| 20 | - <?php if($locale){ ?> |
|
| 20 | + <?php if ($locale) { ?> |
|
| 21 | 21 | <!-- elFinder translation (OPTIONAL) --> |
| 22 | 22 | <script src="<?= asset($dir."/js/i18n/elfinder.$locale.js") ?>"></script> |
| 23 | 23 | <?php } ?> |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $().ready(function() { |
| 41 | 41 | var elf = $('#elfinder').elfinder({ |
| 42 | 42 | // set your elFinder options here |
| 43 | - <?php if($locale){ ?> |
|
| 43 | + <?php if ($locale) { ?> |
|
| 44 | 44 | lang: '<?= $locale ?>', // locale |
| 45 | 45 | <?php } ?> |
| 46 | 46 | customData: { |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | <!-- elFinder JS (REQUIRED) --> |
| 18 | 18 | <script src="<?= asset($dir.'/js/elfinder.min.js') ?>"></script> |
| 19 | 19 | |
| 20 | - <?php if($locale){ ?> |
|
| 20 | + <?php if ($locale) { ?> |
|
| 21 | 21 | <!-- elFinder translation (OPTIONAL) --> |
| 22 | 22 | <script src="<?= asset($dir."/js/i18n/elfinder.$locale.js") ?>"></script> |
| 23 | 23 | <?php } ?> |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $().ready(function() { |
| 41 | 41 | var elf = $('#elfinder').elfinder({ |
| 42 | 42 | // set your elFinder options here |
| 43 | - <?php if($locale){ ?> |
|
| 43 | + <?php if ($locale) { ?> |
|
| 44 | 44 | lang: '<?= $locale ?>', // locale |
| 45 | 45 | <?php } ?> |
| 46 | 46 | customData: { |
@@ -12,14 +12,14 @@ |
||
| 12 | 12 | |-------------------------------------------------------------------------- |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | - public static function getPossibleEnumValues($field_name){ |
|
| 15 | + public static function getPossibleEnumValues($field_name) { |
|
| 16 | 16 | $instance = new static; // create an instance of the model to be able to get the table name |
| 17 | - $type = DB::select( DB::raw('SHOW COLUMNS FROM '.$instance->getTable().' WHERE Field = "'.$field_name.'"') )[0]->Type; |
|
| 17 | + $type = DB::select(DB::raw('SHOW COLUMNS FROM '.$instance->getTable().' WHERE Field = "'.$field_name.'"'))[0]->Type; |
|
| 18 | 18 | preg_match('/^enum\((.*)\)$/', $type, $matches); |
| 19 | 19 | $enum = array(); |
| 20 | 20 | $exploded = explode(',', $matches[1]); |
| 21 | - foreach($exploded as $value){ |
|
| 22 | - $v = trim( $value, "'" ); |
|
| 21 | + foreach ($exploded as $value) { |
|
| 22 | + $v = trim($value, "'"); |
|
| 23 | 23 | $enum[] = $v; |
| 24 | 24 | } |
| 25 | 25 | return $enum; |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | 'model' => "App\Models\Example" |
| 158 | 158 | ], |
| 159 | 159 | ]; |
| 160 | - $this->crud->fields = [ |
|
| 160 | + $this->crud->fields = [ |
|
| 161 | 161 | [ |
| 162 | 162 | 'name' => 'name', |
| 163 | 163 | 'label' => "Example item text" |
@@ -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 | |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | foreach ($this->relations as $key => $relation) |
| 92 | 92 | { |
| 93 | - if ($relation['pivot']){ |
|
| 93 | + if ($relation['pivot']) { |
|
| 94 | 94 | $model->{$relation['name']}()->sync($data[$key]); |
| 95 | 95 | |
| 96 | - foreach($relation['pivotFields'] as $pivotField){ |
|
| 97 | - foreach($data[$pivotField] as $pivot_id => $field){ |
|
| 96 | + foreach ($relation['pivotFields'] as $pivotField) { |
|
| 97 | + foreach ($data[$pivotField] as $pivot_id => $field) { |
|
| 98 | 98 | $model->{$relation['name']}()->updateExistingPivot($pivot_id, [$pivotField => $field]); |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function getUpdateFields($id) |
| 254 | 254 | { |
| 255 | - $fields = $this->prepareFields(empty($this->update_fields)?$this->fields:$this->update_fields); |
|
| 255 | + $fields = $this->prepareFields(empty($this->update_fields) ? $this->fields : $this->update_fields); |
|
| 256 | 256 | $entry = $this->getEntry($id); |
| 257 | 257 | |
| 258 | 258 | foreach ($fields as $k => $field) { |
@@ -376,13 +376,13 @@ discard block |
||
| 376 | 376 | public function allowAccess($access) |
| 377 | 377 | { |
| 378 | 378 | // $this->addButtons((array)$access); |
| 379 | - return $this->access = array_merge(array_diff((array)$access, $this->access), $this->access); |
|
| 379 | + return $this->access = array_merge(array_diff((array) $access, $this->access), $this->access); |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | public function denyAccess($access) |
| 383 | 383 | { |
| 384 | 384 | // $this->removeButtons((array)$access); |
| 385 | - return $this->access = array_diff($this->access, (array)$access); |
|
| 385 | + return $this->access = array_diff($this->access, (array) $access); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | */ |
| 596 | 596 | public function addDefaultTypeToColumn($column) |
| 597 | 597 | { |
| 598 | - if (array_key_exists('name', (array)$column)) |
|
| 598 | + if (array_key_exists('name', (array) $column)) |
|
| 599 | 599 | { |
| 600 | 600 | $default_type = $this->getFieldTypeFromDbColumnType($column['name']); |
| 601 | 601 | return array_merge(['type' => $default_type], $column); |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | * @param [field or column] |
| 612 | 612 | */ |
| 613 | 613 | public function addDefaultLabel($array) { |
| 614 | - if (!array_key_exists('label', (array)$array) && array_key_exists('name', (array)$array)) { |
|
| 614 | + if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
| 615 | 615 | $array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array); |
| 616 | 616 | return $array; |
| 617 | 617 | } |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | array_map(function($field) { |
| 786 | 786 | // $this->labels[$field] = $this->makeLabel($field); |
| 787 | 787 | |
| 788 | - $this->fields[] = [ |
|
| 788 | + $this->fields[] = [ |
|
| 789 | 789 | 'name' => $field, |
| 790 | 790 | 'label' => ucfirst($field), |
| 791 | 791 | 'value' => '', 'default' => $this->field_types[$field]['default'], |
@@ -1127,7 +1127,7 @@ discard block |
||
| 1127 | 1127 | |
| 1128 | 1128 | public function orderColumns($order) |
| 1129 | 1129 | { |
| 1130 | - $this->setSort('columns', (array)$order); |
|
| 1130 | + $this->setSort('columns', (array) $order); |
|
| 1131 | 1131 | } |
| 1132 | 1132 | |
| 1133 | 1133 | |
@@ -1202,13 +1202,13 @@ discard block |
||
| 1202 | 1202 | |
| 1203 | 1203 | public function orderFields($order) |
| 1204 | 1204 | { |
| 1205 | - $this->setSort('fields', (array)$order); |
|
| 1205 | + $this->setSort('fields', (array) $order); |
|
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | |
| 1209 | 1209 | public function syncField($field) |
| 1210 | 1210 | { |
| 1211 | - if (array_key_exists('name', (array)$field)) return array_merge(['type' => $this->getFieldTypeFromDbColumnType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field); |
|
| 1211 | + if (array_key_exists('name', (array) $field)) return array_merge(['type' => $this->getFieldTypeFromDbColumnType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field); |
|
| 1212 | 1212 | |
| 1213 | 1213 | return false; |
| 1214 | 1214 | } |
@@ -1247,7 +1247,7 @@ discard block |
||
| 1247 | 1247 | if (!empty($this->{$type})) |
| 1248 | 1248 | { |
| 1249 | 1249 | $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
| 1250 | - if (in_array($field['name'], (array)$fields)) $field = array_merge($field, $attributes); |
|
| 1250 | + if (in_array($field['name'], (array) $fields)) $field = array_merge($field, $attributes); |
|
| 1251 | 1251 | |
| 1252 | 1252 | return $field; |
| 1253 | 1253 | }, $this->{$type}); |
@@ -1258,7 +1258,7 @@ discard block |
||
| 1258 | 1258 | |
| 1259 | 1259 | public function remove($entity, $fields) |
| 1260 | 1260 | { |
| 1261 | - return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array)$fields);})); |
|
| 1261 | + return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array) $fields); })); |
|
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | 1264 | public function setSort($items, $order) |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) $elements[] = $this->{$items}[$key]; |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | - return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]);})); |
|
| 1280 | + return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]); })); |
|
| 1281 | 1281 | } |
| 1282 | 1282 | |
| 1283 | 1283 | return $this->{$items}; |
@@ -1290,7 +1290,7 @@ discard block |
||
| 1290 | 1290 | // cred ca ia valorile din tabela de legatura ca sa ti le afiseze in select |
| 1291 | 1291 | public function getRelationValues($model, $field, $where = [], $order = []) |
| 1292 | 1292 | { |
| 1293 | - $order = (array)$order; |
|
| 1293 | + $order = (array) $order; |
|
| 1294 | 1294 | $values = $model->select('*'); |
| 1295 | 1295 | |
| 1296 | 1296 | if (!empty($where)) call_user_func_array([$values, $where[0]], array_slice($where, 1)); |
@@ -15,15 +15,15 @@ discard block |
||
| 15 | 15 | $dependencyArray = []; |
| 16 | 16 | |
| 17 | 17 | //convert dependency array to simple matrix ( prymary id as key and array with secondaries id ) |
| 18 | - foreach($dependencies as $primary){ |
|
| 18 | + foreach ($dependencies as $primary) { |
|
| 19 | 19 | $dependencyArray[$primary->id] = []; |
| 20 | - foreach($primary->{$primary_dependency['entity_secondary']} as $secondary){ |
|
| 20 | + foreach ($primary->{$primary_dependency['entity_secondary']} as $secondary) { |
|
| 21 | 21 | $dependencyArray[$primary->id][] = $secondary->id; |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | //for update form, get initial state of the entity |
| 26 | - if( isset($id) && $id ){ |
|
| 26 | + if (isset($id) && $id) { |
|
| 27 | 27 | |
| 28 | 28 | //get entity with relations for primary dependency |
| 29 | 29 | $entity_dependencies = $entity_model->with($primary_dependency['entity']) |
@@ -39,15 +39,15 @@ discard block |
||
| 39 | 39 | $secondary_ids = []; |
| 40 | 40 | |
| 41 | 41 | //create secondary dependency from primary relation, used to check what chekbox must be check from second checklist |
| 42 | - if( old($primary_dependency['name']) ) { |
|
| 43 | - foreach( old($primary_dependency['name']) as $primary_item ){ |
|
| 44 | - foreach($dependencyArray[$primary_item] as $second_item ){ |
|
| 42 | + if (old($primary_dependency['name'])) { |
|
| 43 | + foreach (old($primary_dependency['name']) as $primary_item) { |
|
| 44 | + foreach ($dependencyArray[$primary_item] as $second_item) { |
|
| 45 | 45 | $secondary_ids[$second_item] = $second_item; |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | - }else{ //create dependecies from relation if not from validate error |
|
| 49 | - foreach( $primary_array as $primary_item ){ |
|
| 50 | - foreach($primary_item[$secondary_dependency['entity']] as $second_item ){ |
|
| 48 | + } else { //create dependecies from relation if not from validate error |
|
| 49 | + foreach ($primary_array as $primary_item) { |
|
| 50 | + foreach ($primary_item[$secondary_dependency['entity']] as $second_item) { |
|
| 51 | 51 | $secondary_ids[$second_item['id']] = $second_item['id']; |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <!-- select2 --> |
| 2 | 2 | <div class="form-group"> |
| 3 | 3 | <label>{{ $field['label'] }}</label> |
| 4 | - <?php $entity_model = $crud->getModel();?> |
|
| 4 | + <?php $entity_model = $crud->getModel(); ?> |
|
| 5 | 5 | |
| 6 | 6 | <div class="row"> |
| 7 | 7 | @foreach ($field['model']::all() as $connected_entity_entry) |