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" |
@@ -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) |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $relationFields = []; |
| 103 | 103 | |
| 104 | - foreach($fields as $field){ |
|
| 105 | - if(isset($field['model']) || isset($field['dependencies'])){ |
|
| 104 | + foreach ($fields as $field) { |
|
| 105 | + if (isset($field['model']) || isset($field['dependencies'])) { |
|
| 106 | 106 | array_push($relationFields, $field); |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -118,22 +118,22 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | foreach ($relations as $key => $relation) |
| 120 | 120 | { |
| 121 | - if ( (isset($relation['pivot']) && $relation['pivot'] ) || isset($relation['dependencies']) ){ |
|
| 122 | - if(is_array($relation['name'])){ |
|
| 123 | - foreach($relation['name'] as $relation){ |
|
| 124 | - if(isset($data[$relation])){ |
|
| 121 | + if ((isset($relation['pivot']) && $relation['pivot']) || isset($relation['dependencies'])) { |
|
| 122 | + if (is_array($relation['name'])) { |
|
| 123 | + foreach ($relation['name'] as $relation) { |
|
| 124 | + if (isset($data[$relation])) { |
|
| 125 | 125 | $model->{$relation}()->sync($data[$relation]); |
| 126 | - }else{ |
|
| 126 | + } else { |
|
| 127 | 127 | $model->{$relation}()->sync([]); |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | - }else{ |
|
| 130 | + } else { |
|
| 131 | 131 | $model->{$relation['name']}()->sync($data[$relation['name']]); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if( isset($relation['pivotFields']) ){ |
|
| 135 | - foreach($relation['pivotFields'] as $pivotField){ |
|
| 136 | - foreach($data[$pivotField] as $pivot_id => $field){ |
|
| 134 | + if (isset($relation['pivotFields'])) { |
|
| 135 | + foreach ($relation['pivotFields'] as $pivotField) { |
|
| 136 | + foreach ($data[$pivotField] as $pivot_id => $field) { |
|
| 137 | 137 | $model->{$relation['name']}()->updateExistingPivot($pivot_id, [$pivotField => $field]); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -298,14 +298,14 @@ discard block |
||
| 298 | 298 | // set the value |
| 299 | 299 | if (!isset($fields[$k]['value'])) |
| 300 | 300 | { |
| 301 | - if(is_array($field['name'])){ |
|
| 301 | + if (is_array($field['name'])) { |
|
| 302 | 302 | |
| 303 | 303 | $fields[$k]['value'] = []; |
| 304 | - foreach($field['name'] as $key => $relation){ |
|
| 304 | + foreach ($field['name'] as $key => $relation) { |
|
| 305 | 305 | $fields[$k]['value'][] = $entry->{$relation}; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - }else{ |
|
| 308 | + } else { |
|
| 309 | 309 | $fields[$k]['value'] = $entry->{$field['name']}; |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -424,13 +424,13 @@ discard block |
||
| 424 | 424 | public function allowAccess($access) |
| 425 | 425 | { |
| 426 | 426 | // $this->addButtons((array)$access); |
| 427 | - return $this->access = array_merge(array_diff((array)$access, $this->access), $this->access); |
|
| 427 | + return $this->access = array_merge(array_diff((array) $access, $this->access), $this->access); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | public function denyAccess($access) |
| 431 | 431 | { |
| 432 | 432 | // $this->removeButtons((array)$access); |
| 433 | - return $this->access = array_diff($this->access, (array)$access); |
|
| 433 | + return $this->access = array_diff($this->access, (array) $access); |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | /** |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | */ |
| 644 | 644 | public function addDefaultTypeToColumn($column) |
| 645 | 645 | { |
| 646 | - if (array_key_exists('name', (array)$column)) |
|
| 646 | + if (array_key_exists('name', (array) $column)) |
|
| 647 | 647 | { |
| 648 | 648 | $default_type = $this->getFieldTypeFromDbColumnType($column['name']); |
| 649 | 649 | return array_merge(['type' => $default_type], $column); |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | * @param [field or column] |
| 660 | 660 | */ |
| 661 | 661 | public function addDefaultLabel($array) { |
| 662 | - if (!array_key_exists('label', (array)$array) && array_key_exists('name', (array)$array)) { |
|
| 662 | + if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
| 663 | 663 | $array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array); |
| 664 | 664 | return $array; |
| 665 | 665 | } |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | * @param [array] $options Field-type-specific information. |
| 736 | 736 | * @param string $form The form to add the field to (create/update/both) |
| 737 | 737 | */ |
| 738 | - public function addField($field, $form='both') |
|
| 738 | + public function addField($field, $form = 'both') |
|
| 739 | 739 | { |
| 740 | 740 | // if the field_defition_array array is a string, it means the programmer was lazy and has only passed the name |
| 741 | 741 | // set some default values, so the field will still work |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | * @param string $name Field name (as defined with the addField() procedure) |
| 779 | 779 | * @param string $form update/create/both |
| 780 | 780 | */ |
| 781 | - public function removeField($name, $form='both') |
|
| 781 | + public function removeField($name, $form = 'both') |
|
| 782 | 782 | { |
| 783 | 783 | switch (strtolower($form)) { |
| 784 | 784 | case 'create': |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | * @param array $array_of_names A simple array of the names of the fields to be removed. |
| 802 | 802 | * @param string $form update/create/both |
| 803 | 803 | */ |
| 804 | - public function removeFields($array_of_names, $form='both') |
|
| 804 | + public function removeFields($array_of_names, $form = 'both') |
|
| 805 | 805 | { |
| 806 | 806 | if (!empty($array_of_names)) { |
| 807 | 807 | foreach ($array_of_names as $name) { |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | array_map(function($field) { |
| 923 | 923 | // $this->labels[$field] = $this->makeLabel($field); |
| 924 | 924 | |
| 925 | - $new_field = [ |
|
| 925 | + $new_field = [ |
|
| 926 | 926 | 'name' => $field, |
| 927 | 927 | 'label' => ucfirst($field), |
| 928 | 928 | 'value' => '', 'default' => $this->field_types[$field]['default'], |
@@ -1263,7 +1263,7 @@ discard block |
||
| 1263 | 1263 | |
| 1264 | 1264 | public function orderColumns($order) |
| 1265 | 1265 | { |
| 1266 | - $this->setSort('columns', (array)$order); |
|
| 1266 | + $this->setSort('columns', (array) $order); |
|
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | |
@@ -1338,7 +1338,7 @@ discard block |
||
| 1338 | 1338 | |
| 1339 | 1339 | public function orderFields($order) |
| 1340 | 1340 | { |
| 1341 | - $this->setSort('fields', (array)$order); |
|
| 1341 | + $this->setSort('fields', (array) $order); |
|
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | 1344 | |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | if (!empty($this->{$type})) |
| 1385 | 1385 | { |
| 1386 | 1386 | $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
| 1387 | - if (in_array($field['name'], (array)$fields)) $field = array_merge($field, $attributes); |
|
| 1387 | + if (in_array($field['name'], (array) $fields)) $field = array_merge($field, $attributes); |
|
| 1388 | 1388 | |
| 1389 | 1389 | return $field; |
| 1390 | 1390 | }, $this->{$type}); |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) $elements[] = $this->{$items}[$key]; |
| 1415 | 1415 | } |
| 1416 | 1416 | |
| 1417 | - return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]);})); |
|
| 1417 | + return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]); })); |
|
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | return $this->{$items}; |
@@ -1427,7 +1427,7 @@ discard block |
||
| 1427 | 1427 | // cred ca ia valorile din tabela de legatura ca sa ti le afiseze in select |
| 1428 | 1428 | public function getRelationValues($model, $field, $where = [], $order = []) |
| 1429 | 1429 | { |
| 1430 | - $order = (array)$order; |
|
| 1430 | + $order = (array) $order; |
|
| 1431 | 1431 | $values = $model->select('*'); |
| 1432 | 1432 | |
| 1433 | 1433 | if (!empty($where)) call_user_func_array([$values, $where[0]], array_slice($where, 1)); |