Passed
Push — master ( b43194...ce05c1 )
by Ferry
04:20
created
src/controllers/scaffolding/singletons/ColumnSingleton.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
     public function valueAssignment($data_row = null) {
43 43
         foreach ($this->getColumns() as $index=>$column) {
44 44
 
45
-            if (! $column->getName()) {
45
+            if (!$column->getName()) {
46 46
                 continue;
47 47
             }
48 48
 
49 49
             /** @var ColumnModel $column */
50
-            if($data_row) {
51
-                $value = (isset($data_row->{$column->getField()}))?$data_row->{ $column->getField() }:null;
52
-            }else{
50
+            if ($data_row) {
51
+                $value = (isset($data_row->{$column->getField()})) ? $data_row->{ $column->getField() }:null;
52
+            } else {
53 53
                 $value = request($column->getName());
54 54
 
55
-                if(!$value && $column->getDefaultValue()) {
55
+                if (!$value && $column->getDefaultValue()) {
56 56
                     $value = $column->getDefaultValue();
57 57
                 }
58 58
 
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $data = $this->columns;
70 70
         $newData = [];
71
-        foreach($data as $i=>$item) {
71
+        foreach ($data as $i=>$item) {
72 72
             /** @var ColumnModel $item */
73
-            if($item->getShowIndex()) {
73
+            if ($item->getShowIndex()) {
74 74
                 $newData[] = $item;
75 75
             }
76 76
         }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $data = $this->columns;
83 83
         $newData = [];
84
-        foreach($data as $i=>$item) {
84
+        foreach ($data as $i=>$item) {
85 85
             /** @var ColumnModel $item */
86
-            if($item->getShowAdd() || $item->getShowEdit()) {
86
+            if ($item->getShowAdd() || $item->getShowEdit()) {
87 87
                 $newData[] = $item;
88 88
             }
89 89
         }
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $data = $this->columns;
96 96
         $newData = [];
97
-        foreach($data as $i=>$item) {
97
+        foreach ($data as $i=>$item) {
98 98
             /** @var ColumnModel $item */
99
-            if($item->getShowEdit()) {
99
+            if ($item->getShowEdit()) {
100 100
                 $newData[] = $item;
101 101
             }
102 102
         }
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
     {
108 108
         $data = $this->columns;
109 109
         $newData = [];
110
-        foreach($data as $i=>$item) {
110
+        foreach ($data as $i=>$item) {
111 111
             /** @var ColumnModel $item */
112
-            if($item->getShowAdd()) {
112
+            if ($item->getShowAdd()) {
113 113
                 $newData[] = $item;
114 114
             }
115 115
         }
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
     {
121 121
         $data = $this->columns;
122 122
         $newData = [];
123
-        foreach($data as $i=>$item) {
123
+        foreach ($data as $i=>$item) {
124 124
             /** @var ColumnModel $item */
125
-            if($item->getFilterable()) {
125
+            if ($item->getFilterable()) {
126 126
                 $newData[] = $item;
127 127
             }
128 128
         }
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $data = $this->columns;
135 135
         $newData = [];
136
-        foreach($data as $i=>$item) {
136
+        foreach ($data as $i=>$item) {
137 137
             /** @var ColumnModel $item */
138
-            if($item->getShowDetail()) {
138
+            if ($item->getShowDetail()) {
139 139
                 $newData[] = $item;
140 140
             }
141 141
         }
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
     public function getAssignmentData()
146 146
     {
147 147
         $data = [];
148
-        foreach($this->columns as $column) {
148
+        foreach ($this->columns as $column) {
149 149
             /** @var ColumnModel $column */
150 150
 
151
-            if(is_array($column->getValue())) {
152
-                foreach($column->getValue() as $key=>$val) {
151
+            if (is_array($column->getValue())) {
152
+                foreach ($column->getValue() as $key=>$val) {
153 153
                     $data[$key] = $val;
154 154
                 }
155
-            }else{
155
+            } else {
156 156
                 $data[$column->getField()] = $column->getValue();
157 157
             }
158 158
         }
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
     public function removeColumn($label_or_name)
163 163
     {
164 164
         $data = $this->getColumns();
165
-        foreach($data as $i=>$d)
165
+        foreach ($data as $i=>$d)
166 166
         {
167 167
             /** @var ColumnModel $d */
168
-            if($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) {
168
+            if ($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) {
169 169
                 unset($data[$i]);
170 170
             }
171 171
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     public function getColumnNameOnly()
176 176
     {
177 177
         $result = [];
178
-        foreach($this->columns as $column) {
178
+        foreach ($this->columns as $column) {
179 179
             /** @var ColumnModel $column */
180 180
             $result[] = $column->getName();
181 181
         }
Please login to merge, or discard this patch.
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/types/text/Hook.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function indexRender($row, $column)
23 23
     {
24 24
         $value = trim(strip_tags($row->{ $column->getField() }));
25
-        if($column->getLimit()) {
25
+        if ($column->getLimit()) {
26 26
             $value = Str::limit($value, $column->getLimit());
27 27
         }
28 28
         return $value;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function filterQuery($query, $column, $value)
33 33
     {
34
-        $query->where($column->getFilterColumn(),"like","%".$value."%");
34
+        $query->where($column->getFilterColumn(), "like", "%".$value."%");
35 35
         return $query;
36 36
     }
37 37
 
Please login to merge, or discard this patch.
src/types/select_table/filter.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
     /** @var \crocodicstudio\crudbooster\types\text\TextModel $column */
3
-    $filterName = "filter_".slug($column->getFilterColumn(),"_");
3
+    $filterName = "filter_".slug($column->getFilterColumn(), "_");
4 4
     $filterValue = sanitizeXSS(request($filterName));
5 5
 ?>
6 6
 <select name="filter_{{ slug($column->getFilterColumn(),"_") }}" style="width: 100%" id="filter_{{ $column->getName()  }}" class="form-control select2">
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.
src/views/dev_layouts/modules/appearance/index.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
                                 <label>Dashboard Controller</label>
58 58
                                 <select name="dashboard_controller" class="form-control">
59 59
                                     <option value="">** Default CB</option>
60
-                                    <?php $controllers = glob(app_path("Http/Controllers/*Controller.php"));?>
60
+                                    <?php $controllers = glob(app_path("Http/Controllers/*Controller.php")); ?>
61 61
                                     @foreach($controllers as $controller)
62 62
                                         @if(basename($controller) != "Controller.php")
63 63
                                         <option {{ getSetting("dashboard_controller")==rtrim(basename($controller),".php")?"selected":"" }} value="{{ rtrim(basename($controller),".php") }}">{{ rtrim(basename($controller),".php") }}</option>
Please login to merge, or discard this patch.
src/types/image/Hook.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         // Direct return value because its been uploaded on client side
25 25
         $ext = strtolower(pathinfo($value, PATHINFO_EXTENSION));
26
-        if(in_array($ext, cbConfig("UPLOAD_IMAGE_EXTENSION_ALLOWED"))) {
26
+        if (in_array($ext, cbConfig("UPLOAD_IMAGE_EXTENSION_ALLOWED"))) {
27 27
             return $value;
28 28
         }
29 29
     }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function detailRender($row, $column)
32 32
     {
33 33
         $column->setValue($row->{ $column->getField() });
34
-        return view("types::image.detail",[
34
+        return view("types::image.detail", [
35 35
             'row'=>$row,
36 36
             'column'=>$column
37 37
         ]);
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public function indexRender($row, $column)
41 41
     {
42 42
         $column->setValue($row->{ $column->getField() });
43
-        return view("types::image.index",[
43
+        return view("types::image.index", [
44 44
             'row'=>$row,
45 45
             'column'=>$column
46 46
         ]);
Please login to merge, or discard this patch.
src/types/file/Hook.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function assignment($value, $column)
23 23
     {
24 24
         $ext = strtolower(pathinfo($value, PATHINFO_EXTENSION));
25
-        if(in_array($ext, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
25
+        if (in_array($ext, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
26 26
             return $value;
27 27
         }
28 28
     }
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public function detailRender($row, $column)
31 31
     {
32 32
         $column->setValue($row->{ $column->getField() });
33
-        return view("types::file.detail",[
33
+        return view("types::file.detail", [
34 34
             'row'=>$row,
35 35
             'column'=>$column
36 36
         ]);
Please login to merge, or discard this patch.
src/controllers/CBController.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function getIndex()
34 34
     {
35
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
35
+        if (!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
36 36
 
37 37
         $query = $this->repository();
38
-        $result = $query->paginate( request("limit")?:$this->data['limit'] );
38
+        $result = $query->paginate(request("limit") ?: $this->data['limit']);
39 39
         $data['result'] = $result;
40 40
 
41 41
         return view("crudbooster::module.index.index", array_merge($data, $this->data));
@@ -43,17 +43,17 @@  discard block
 block discarded – undo
43 43
 
44 44
     public function getAdd()
45 45
     {
46
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
46
+        if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
47 47
 
48 48
         $data = [];
49 49
         $data['page_title'] = $this->data['page_title'].' : '.cbLang('add');
50 50
         $data['action_url'] = module()->addSaveURL();
51
-        return view('crudbooster::module.form.form',array_merge($data, $this->data));
51
+        return view('crudbooster::module.form.form', array_merge($data, $this->data));
52 52
     }
53 53
 
54 54
     public function postAddSave()
55 55
     {
56
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
56
+        if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
57 57
 
58 58
         try {
59 59
             $this->validation();
@@ -61,38 +61,38 @@  discard block
 block discarded – undo
61 61
             $data = columnSingleton()->getAssignmentData();
62 62
 
63 63
             //Clear data from Primary Key
64
-            unset($data[ cb()->pk($this->data['table']) ]);
64
+            unset($data[cb()->pk($this->data['table'])]);
65 65
 
66
-            if(Schema::hasColumn($this->data['table'], 'created_at')) {
66
+            if (Schema::hasColumn($this->data['table'], 'created_at')) {
67 67
                 $data['created_at'] = date('Y-m-d H:i:s');
68 68
             }
69 69
 
70
-            if(Schema::hasColumn($this->data['table'], 'updated_at')) {
70
+            if (Schema::hasColumn($this->data['table'], 'updated_at')) {
71 71
                 $data['updated_at'] = date('Y-m-d H:i:s');
72 72
             }
73 73
 
74
-            if(isset($this->data['hook_before_insert']) && is_callable($this->data['hook_before_insert'])) {
74
+            if (isset($this->data['hook_before_insert']) && is_callable($this->data['hook_before_insert'])) {
75 75
                 $data = call_user_func($this->data['hook_before_insert'], $data);
76 76
             }
77 77
 
78 78
             $id = DB::table($this->data['table'])->insertGetId($data);
79 79
 
80
-            if(isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) {
80
+            if (isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) {
81 81
                 call_user_func($this->data['hook_after_insert'], $id);
82 82
             }
83 83
 
84 84
         } catch (CBValidationException $e) {
85 85
             Log::debug($e);
86
-            return cb()->redirectBack($e->getMessage(),'info');
86
+            return cb()->redirectBack($e->getMessage(), 'info');
87 87
         } catch (\Exception $e) {
88 88
             Log::error($e);
89
-            return cb()->redirectBack(cbLang("something_went_wrong"),'warning');
89
+            return cb()->redirectBack(cbLang("something_went_wrong"), 'warning');
90 90
         }
91 91
 
92
-        if (Str::contains(request("submit"),cbLang("more"))) {
92
+        if (Str::contains(request("submit"), cbLang("more"))) {
93 93
             return cb()->redirectBack(cbLang("the_data_has_been_added"), 'success');
94 94
         } else {
95
-            if(verifyReferalUrl()) {
95
+            if (verifyReferalUrl()) {
96 96
                 return cb()->redirect(getReferalUrl("url"), cbLang("the_data_has_been_added"), 'success');
97 97
             } else {
98 98
                 return cb()->redirect(module()->url(), cbLang("the_data_has_been_added"), 'success');
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
     public function getEdit($id)
104 104
     {
105
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
105
+        if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
106 106
 
107 107
         $data = [];
108 108
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     public function postEditSave($id)
115 115
     {
116
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
116
+        if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
117 117
 
118 118
         try {
119 119
             $this->validation();
@@ -121,40 +121,40 @@  discard block
 block discarded – undo
121 121
             $data = columnSingleton()->getAssignmentData();
122 122
 
123 123
             // Make sure the Primary Key is not included
124
-            unset($data[ cb()->pk($this->data['table']) ]);
124
+            unset($data[cb()->pk($this->data['table'])]);
125 125
 
126
-            if(Schema::hasColumn($this->data['table'], 'updated_at')) {
126
+            if (Schema::hasColumn($this->data['table'], 'updated_at')) {
127 127
                 $data['updated_at'] = date('Y-m-d H:i:s');
128 128
             }
129 129
 
130 130
             unset($data['created_at']);
131 131
 
132
-            if(isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) {
132
+            if (isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) {
133 133
                 $data = call_user_func($this->data['hook_before_update'], $data, $id);
134 134
             }
135 135
 
136 136
             cb()->update($this->data['table'], $id, $data);
137 137
 
138
-            if(isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) {
138
+            if (isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) {
139 139
                 call_user_func($this->data['hook_after_update'], $id);
140 140
             }
141 141
 
142 142
         } catch (CBValidationException $e) {
143 143
             Log::debug($e);
144
-            return cb()->redirectBack($e->getMessage(),'info');
144
+            return cb()->redirectBack($e->getMessage(), 'info');
145 145
         } catch (\Exception $e) {
146 146
             Log::error($e);
147
-            return cb()->redirectBack(cbLang("something_went_wrong"),'warning');
147
+            return cb()->redirectBack(cbLang("something_went_wrong"), 'warning');
148 148
         }
149 149
 
150 150
 
151 151
         if (Str::contains(request("submit"), cbLang("more"))) {
152
-            return cb()->redirectBack( cbLang("the_data_has_been_updated"), 'success');
152
+            return cb()->redirectBack(cbLang("the_data_has_been_updated"), 'success');
153 153
         } else {
154
-            if(verifyReferalUrl()) {
155
-                return cb()->redirect(getReferalUrl("url"),  cbLang("the_data_has_been_updated"), 'success');
154
+            if (verifyReferalUrl()) {
155
+                return cb()->redirect(getReferalUrl("url"), cbLang("the_data_has_been_updated"), 'success');
156 156
             } else {
157
-                return cb()->redirect(module()->url(),  cbLang("the_data_has_been_updated"), 'success');
157
+                return cb()->redirect(module()->url(), cbLang("the_data_has_been_updated"), 'success');
158 158
             }
159 159
 
160 160
         }
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
 
163 163
     public function getDelete($id)
164 164
     {
165
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
165
+        if (!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
166 166
 
167
-        if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
167
+        if (isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
168 168
             call_user_func($this->data['hook_before_delete'], $id);
169 169
         }
170 170
 
171
-        $softDelete = isset($this->data['disable_soft_delete'])?$this->data['disable_soft_delete']:true;
171
+        $softDelete = isset($this->data['disable_soft_delete']) ? $this->data['disable_soft_delete'] : true;
172 172
 
173
-        if ($softDelete === true && Schema::hasColumn($this->data['table'],'deleted_at')) {
173
+        if ($softDelete === true && Schema::hasColumn($this->data['table'], 'deleted_at')) {
174 174
             DB::table($this->data['table'])
175 175
                 ->where(getPrimaryKey($this->data['table']), $id)
176 176
                 ->update(['deleted_at' => date('Y-m-d H:i:s')]);
@@ -180,16 +180,16 @@  discard block
 block discarded – undo
180 180
                 ->delete();
181 181
         }
182 182
 
183
-        if(isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) {
183
+        if (isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) {
184 184
             call_user_func($this->data['hook_after_delete'], $id);
185 185
         }
186 186
 
187
-        return cb()->redirectBack( cbLang("the_data_has_been_deleted"), 'success');
187
+        return cb()->redirectBack(cbLang("the_data_has_been_deleted"), 'success');
188 188
     }
189 189
 
190 190
     public function getDetail($id)
191 191
     {
192
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
192
+        if (!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
193 193
 
194 194
         $data = [];
195 195
         $data['row'] = $this->repository()->where($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), $id)->first();
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
      */
209 209
     public function __call($method, $parameters)
210 210
     {
211
-        if($method == "getData") {
211
+        if ($method == "getData") {
212 212
             $key = $parameters[0];
213
-            if(isset($this->data[$key])) {
213
+            if (isset($this->data[$key])) {
214 214
                 return $this->data[$key];
215
-            }else{
215
+            } else {
216 216
                 return null;
217 217
             }
218
-        }else{
218
+        } else {
219 219
             return null;
220 220
         }
221 221
     }
Please login to merge, or discard this patch.