Passed
Push — master ( 5e9f02...c9dd23 )
by Ferry
03:53
created
src/views/dev_layouts/modules/modules/add.blade.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                                             <select v-model="item.column_type" @change="changeTypeColumn($event, idx)" class="column_type form-control">
224 224
                                                 @foreach($types as $type)
225 225
                                                     @if($type != "." && $type != ".." && is_dir($dirPath.'/'.$type))
226
-                                                        <?php $filterable = (file_exists($dirPath."/filter.blade.php"))?1:0; ?>
226
+                                                        <?php $filterable = (file_exists($dirPath."/filter.blade.php")) ? 1 : 0; ?>
227 227
                                                         <option data-filterable="{{ $filterable }}" value="{{ $type }}">{{ $type }}</option>
228 228
                                                     @endif
229 229
                                                 @endforeach
@@ -797,21 +797,21 @@  discard block
 block discarded – undo
797 797
                     <?php
798 798
                     $font = new \crocodicstudio\crudbooster\helpers\FontAwesome();
799 799
                     $fontData = [
800
-                        ["data"=>$font->text(),"label"=>"Text"],
801
-                        ["data"=>$font->web(),"label"=>"Web"],
802
-                        ["data"=>$font->video(),"label"=>"Video"],
803
-                        ["data"=>$font->transportation(),"label"=>"Transportation"],
804
-                        ["data"=>$font->payment(),"label"=>"Payment"],
805
-                        ["data"=>$font->medical(),"label"=>"Medical"],
806
-                        ["data"=>$font->hand(),"label"=>"Hand"],
807
-                        ["data"=>$font->fileType(),"label"=>"File Type"],
808
-                        ["data"=>$font->directional(),"label"=>"Directional"],
809
-                        ["data"=>$font->currency(),"label"=>"Currency"],
810
-                        ["data"=>$font->chart(),"label"=>"Chart"],
811
-                        ["data"=>$font->brands(),"label"=>"Brand"],
812
-                        ["data"=>$font->gender(),"label"=>"Gender"],
813
-                        ["data"=>$font->form(),"label"=>"Form"],
814
-                        ["data"=>$font->spinner(),"label"=>"Spinner"]
800
+                        ["data"=>$font->text(), "label"=>"Text"],
801
+                        ["data"=>$font->web(), "label"=>"Web"],
802
+                        ["data"=>$font->video(), "label"=>"Video"],
803
+                        ["data"=>$font->transportation(), "label"=>"Transportation"],
804
+                        ["data"=>$font->payment(), "label"=>"Payment"],
805
+                        ["data"=>$font->medical(), "label"=>"Medical"],
806
+                        ["data"=>$font->hand(), "label"=>"Hand"],
807
+                        ["data"=>$font->fileType(), "label"=>"File Type"],
808
+                        ["data"=>$font->directional(), "label"=>"Directional"],
809
+                        ["data"=>$font->currency(), "label"=>"Currency"],
810
+                        ["data"=>$font->chart(), "label"=>"Chart"],
811
+                        ["data"=>$font->brands(), "label"=>"Brand"],
812
+                        ["data"=>$font->gender(), "label"=>"Gender"],
813
+                        ["data"=>$font->form(), "label"=>"Form"],
814
+                        ["data"=>$font->spinner(), "label"=>"Spinner"]
815 815
                     ];
816 816
                     ?>
817 817
                     @foreach($fontData as $f)
Please login to merge, or discard this patch.
src/helpers/ModuleGenerator.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
     }
38 38
 
39 39
     public function make() {
40
-        $name = trim(($this->name)?:ucwords(str_replace("_"," ",$this->table)));
40
+        $name = trim(($this->name) ?: ucwords(str_replace("_", " ", $this->table)));
41 41
 
42 42
         $template = file_get_contents(__DIR__."/../templates/FooBarController.stub");
43 43
 
44 44
         //Replace table
45
-        $template = str_replace("{table}",'"'.$this->table.'"', $template);
45
+        $template = str_replace("{table}", '"'.$this->table.'"', $template);
46 46
 
47 47
         //Replace permalink
48
-        $permalink = strtolower(Str::slug($name,"_"));
48
+        $permalink = strtolower(Str::slug($name, "_"));
49 49
         $template = str_replace("{permalink}", '"'.$permalink.'"', $template);
50 50
 
51 51
         //Replace Page title
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 
54 54
         //Replace scaffolding
55 55
         $scaffold = "";
56
-        foreach($this->columns as $field) {
56
+        foreach ($this->columns as $field) {
57 57
             $label = $field['column_label'];
58 58
             $column = $field['column_field'];
59
-            $help = isset($field['column_help'])?"->help(\"".$field['column_help']."\")":"";
60
-            $required = ($field['column_mandatory']=="on")?"":"->required(false)";
61
-            $indexShow = ($field['column_browse']=="on")?"":"->showIndex(false)";
62
-            $detailShow = ($field['column_detail']=="on")?"":"->showDetail(false)";
63
-            $editShow = ($field['column_edit']=="on")?"":"->showEdit(false)";
64
-            $addShow = ($field['column_add']=="on")?"":"->showAdd(false)";
59
+            $help = isset($field['column_help']) ? "->help(\"".$field['column_help']."\")" : "";
60
+            $required = ($field['column_mandatory'] == "on") ? "" : "->required(false)";
61
+            $indexShow = ($field['column_browse'] == "on") ? "" : "->showIndex(false)";
62
+            $detailShow = ($field['column_detail'] == "on") ? "" : "->showDetail(false)";
63
+            $editShow = ($field['column_edit'] == "on") ? "" : "->showEdit(false)";
64
+            $addShow = ($field['column_add'] == "on") ? "" : "->showAdd(false)";
65 65
             $optionTable = $field['column_option_table'];
66 66
             $optionValue = $field['column_option_value'];
67 67
             $optionDisplay = $field['column_option_display'];
68 68
             $optionSqlCondition = $field['column_option_sql_condition'];
69
-            $optionSqlCondition = str_replace('"',"'", $optionSqlCondition);
69
+            $optionSqlCondition = str_replace('"', "'", $optionSqlCondition);
70 70
             $sqlRawQuery = $field['column_sql_query'];
71 71
             $options = $field['column_options'];
72 72
             $imageResizeWidth = $field['column_image_width'];
@@ -80,49 +80,49 @@  discard block
 block discarded – undo
80 80
             $moneyPrecision = $field['column_money_precision'];
81 81
             $moneyThousandSeparator = $field['column_money_thousand_separator'];
82 82
             $moneyDecimalSeparator = $field['column_money_decimal_separator'];
83
-            $filterable = ($field['column_filterable']=="on")?"->filterable(true)":"";
84
-            $foreign_key = (isset($field['column_foreign']))?"->foreignKey('".$field['column_foreign']."')":"";
83
+            $filterable = ($field['column_filterable'] == "on") ? "->filterable(true)" : "";
84
+            $foreign_key = (isset($field['column_foreign'])) ? "->foreignKey('".$field['column_foreign']."')" : "";
85 85
 
86 86
             // Additional Attributes
87
-            $additional = $required . $indexShow . $detailShow . $addShow . $editShow . $help . $filterable . $foreign_key ;
87
+            $additional = $required.$indexShow.$detailShow.$addShow.$editShow.$help.$filterable.$foreign_key;
88 88
 
89 89
             // Additional money
90
-            $additional .= ($moneyPrefix && $field['column_type']=='money')?"->prefix('".$moneyPrefix."')":"";
91
-            $additional .= ($moneyPrecision && $field['column_type']=='money')?"->precision('".$moneyPrecision."')":"";
92
-            $additional .= ($moneyThousandSeparator && $field['column_type']=='money')?"->thousandSeparator('".$moneyThousandSeparator."')":"";
93
-            $additional .= ($moneyDecimalSeparator && $field['column_type']=='money')?"->decimalSeparator('".$moneyDecimalSeparator."')":"";
90
+            $additional .= ($moneyPrefix && $field['column_type'] == 'money') ? "->prefix('".$moneyPrefix."')" : "";
91
+            $additional .= ($moneyPrecision && $field['column_type'] == 'money') ? "->precision('".$moneyPrecision."')" : "";
92
+            $additional .= ($moneyThousandSeparator && $field['column_type'] == 'money') ? "->thousandSeparator('".$moneyThousandSeparator."')" : "";
93
+            $additional .= ($moneyDecimalSeparator && $field['column_type'] == 'money') ? "->decimalSeparator('".$moneyDecimalSeparator."')" : "";
94 94
 
95 95
             // Additional for image & file type
96
-            $additional .= ($fileEncrypt && in_array($field['column_type'],['file','image']))?"->encrypt(true)":"";
97
-            $additional .= ($imageResizeWidth && in_array($field['column_type'],['file','image']))?"->resize(".$imageResizeWidth.",".$imageResizeHeight.")":"";
96
+            $additional .= ($fileEncrypt && in_array($field['column_type'], ['file', 'image'])) ? "->encrypt(true)" : "";
97
+            $additional .= ($imageResizeWidth && in_array($field['column_type'], ['file', 'image'])) ? "->resize(".$imageResizeWidth.",".$imageResizeHeight.")" : "";
98 98
 
99 99
             // Additional for date & datetime
100
-            $additional .= ($dateFormat && in_array($field['column_type'],['date','datetime']))?"->format('".$dateFormat."')":"";
100
+            $additional .= ($dateFormat && in_array($field['column_type'], ['date', 'datetime'])) ? "->format('".$dateFormat."')" : "";
101 101
 
102 102
             // Additional for text
103
-            $additional .= ($textDisplayLimit!="" && in_array($field['column_type'],['text','text_area','wysiwyg']))?"->strLimit(".$textDisplayLimit.")":"";
104
-            $additional .= ($maxCharacter!="" && in_array($field['column_type'],['text','text_area']))?"->maxLength(".$maxCharacter.")":"";
105
-            $additional .= ($minCharacter!="" && in_array($field['column_type'],['text','text_area']))?"->minLength(".$minCharacter.")":"";
103
+            $additional .= ($textDisplayLimit != "" && in_array($field['column_type'], ['text', 'text_area', 'wysiwyg'])) ? "->strLimit(".$textDisplayLimit.")" : "";
104
+            $additional .= ($maxCharacter != "" && in_array($field['column_type'], ['text', 'text_area'])) ? "->maxLength(".$maxCharacter.")" : "";
105
+            $additional .= ($minCharacter != "" && in_array($field['column_type'], ['text', 'text_area'])) ? "->minLength(".$minCharacter.")" : "";
106 106
 
107 107
             $methodName = Str::studly($field['column_type']);
108
-            if($label && $column) {
109
-                if(in_array($field['column_type'],['radio','select_option','checkbox'])) {
110
-                    if($options) {
108
+            if ($label && $column) {
109
+                if (in_array($field['column_type'], ['radio', 'select_option', 'checkbox'])) {
110
+                    if ($options) {
111 111
                         $optResult = [];
112
-                        foreach($options as $opt) {
112
+                        foreach ($options as $opt) {
113 113
                             $optResult[$opt['key']] = $opt['label'];
114 114
                         }
115
-                        $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '")->options('.min_var_export($optResult).')' . $additional . ';' . "\n\t\t";
115
+                        $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")->options('.min_var_export($optResult).')'.$additional.';'."\n\t\t";
116 116
                     }
117
-                }elseif (in_array($field['column_type'],['radio_table','select_table'])) {
117
+                }elseif (in_array($field['column_type'], ['radio_table', 'select_table'])) {
118 118
                     if ($optionTable && $optionValue && $optionDisplay) {
119
-                        $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '",["table"=>"' . $optionTable . '","value_option"=>"' . $optionValue . '","display_option"=>"' . $optionDisplay . '","sql_condition"=>"' . $optionSqlCondition . '"])' . $additional . ';' . "\n\t\t";
119
+                        $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'",["table"=>"'.$optionTable.'","value_option"=>"'.$optionValue.'","display_option"=>"'.$optionDisplay.'","sql_condition"=>"'.$optionSqlCondition.'"])'.$additional.';'."\n\t\t";
120 120
                     }
121 121
                 }elseif ($field['column_type'] == "select_query") {
122
-                    if($sqlRawQuery && Str::contains($sqlRawQuery,["as `key`","as `label`"])) {
123
-                        $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '","'.$sqlRawQuery.'")' . $additional . ';' . "\n\t\t";
122
+                    if ($sqlRawQuery && Str::contains($sqlRawQuery, ["as `key`", "as `label`"])) {
123
+                        $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'","'.$sqlRawQuery.'")'.$additional.';'."\n\t\t";
124 124
                     }
125
-                }else{
125
+                } else {
126 126
                     $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")'.$additional.';'."\n\t\t";
127 127
                 }
128 128
             }
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
         $module['controller'] = $filename;
146 146
         $module['last_column_build'] = json_encode($this->columns);
147 147
 
148
-        if($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name",$this->table)->first()) {
149
-            DB::table("cb_modules")->where("id",$moduleData->id)->update($module);
148
+        if ($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name", $this->table)->first()) {
149
+            DB::table("cb_modules")->where("id", $moduleData->id)->update($module);
150 150
             $id_modules = $moduleData->id;
151
-        }else{
151
+        } else {
152 152
             $id_modules = DB::table('cb_modules')->insertGetId($module);
153 153
         }
154 154
 
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
         $menu['name'] = $module['name'];
158 158
         $menu['type'] = 'module';
159 159
         $menu['cb_modules_id'] = $id_modules;
160
-        if(isset($moduleData)) {
161
-            DB::table("cb_menus")->where("cb_modules_id",$moduleData->id)->update($menu);
162
-        }else{
160
+        if (isset($moduleData)) {
161
+            DB::table("cb_menus")->where("cb_modules_id", $moduleData->id)->update($menu);
162
+        } else {
163 163
             DB::table('cb_menus')->insertGetId($menu);
164 164
         }
165 165
 
Please login to merge, or discard this patch.