Passed
Push — master ( 5403d4...38a665 )
by Ferry
04:29
created
src/controllers/CBController.php 2 patches
Braces   +27 added lines, -13 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
             $key = $parameters[0];
31 31
             if(isset($this->data[$key])) {
32 32
                 return $this->data[$key];
33
-            }else{
33
+            } else{
34 34
                 return null;
35 35
             }
36
-        }else{
36
+        } else{
37 37
             return null;
38 38
         }
39 39
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                     if(Schema::hasColumn($this->data['table'], $column->getField())) {
78 78
                         $query->addSelect($this->data['table'].'.'.$column->getField());
79 79
                     }
80
-                }else{
80
+                } else{
81 81
                     $query->addSelect($column->getField());
82 82
                 }
83 83
             }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         {
90 90
             if(isset($this->data['hook_search_query'])) {
91 91
                 $query = call_user_func($this->data['hook_search_query'], $query);
92
-            }else{
92
+            } else{
93 93
                 $query->where(function ($where) use ($columns) {
94 94
                     /**
95 95
                      * @var $where Builder
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                     {
99 99
                         if(strpos($column->getField(),".") === false) {
100 100
                             $field = $this->data['table'].'.'.$column->getField();
101
-                        }else{
101
+                        } else{
102 102
                             $field = $column->getField();
103 103
                         }
104 104
                         $where->orWhere($field, 'like', '%'.request('q').'%');
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) {
118 118
                 $query->orderBy(request('order_by'), request('order_sort'));
119 119
             }
120
-        }else{
120
+        } else{
121 121
             $query->orderBy($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), "desc");
122 122
         }
123 123
 
@@ -126,7 +126,9 @@  discard block
 block discarded – undo
126 126
 
127 127
     public function getIndex()
128 128
     {
129
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
129
+        if(!module()->canBrowse()) {
130
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
131
+        }
130 132
 
131 133
         $query = $this->repository();
132 134
         $result = $query->paginate( request("limit")?:cbConfig("LIMIT_TABLE_DATA") );
@@ -153,7 +155,9 @@  discard block
 block discarded – undo
153 155
 
154 156
     public function getAdd()
155 157
     {
156
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
158
+        if(!module()->canCreate()) {
159
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
160
+        }
157 161
 
158 162
         $data = [];
159 163
         $data['page_title'] = $this->data['page_title'].' : Add';
@@ -163,7 +167,9 @@  discard block
 block discarded – undo
163 167
 
164 168
     public function postAddSave()
165 169
     {
166
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
170
+        if(!module()->canCreate()) {
171
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
172
+        }
167 173
 
168 174
         try {
169 175
             $this->validation();
@@ -204,7 +210,9 @@  discard block
 block discarded – undo
204 210
 
205 211
     public function getEdit($id)
206 212
     {
207
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
213
+        if(!module()->canUpdate()) {
214
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
215
+        }
208 216
 
209 217
         $data = [];
210 218
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
@@ -215,7 +223,9 @@  discard block
 block discarded – undo
215 223
 
216 224
     public function postEditSave($id)
217 225
     {
218
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
226
+        if(!module()->canUpdate()) {
227
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
228
+        }
219 229
 
220 230
         try {
221 231
             $this->validation();
@@ -259,7 +269,9 @@  discard block
 block discarded – undo
259 269
 
260 270
     public function getDelete($id)
261 271
     {
262
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
272
+        if(!module()->canDelete()) {
273
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
274
+        }
263 275
 
264 276
         if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
265 277
             call_user_func($this->data['hook_before_delete'], $id);
@@ -286,7 +298,9 @@  discard block
 block discarded – undo
286 298
 
287 299
     public function getDetail($id)
288 300
     {
289
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
301
+        if(!module()->canRead()) {
302
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
303
+        }
290 304
 
291 305
         $data = [];
292 306
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function __call($method, $parameters)
28 28
     {
29
-        if($method == "getData") {
29
+        if ($method == "getData") {
30 30
             $key = $parameters[0];
31
-            if(isset($this->data[$key])) {
31
+            if (isset($this->data[$key])) {
32 32
                 return $this->data[$key];
33
-            }else{
33
+            } else {
34 34
                 return null;
35 35
             }
36
-        }else{
36
+        } else {
37 37
             return null;
38 38
         }
39 39
     }
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 
48 48
         $query->addSelect($this->data['table'].'.'.cb()->pk($this->data['table']).' as primary_key');
49 49
 
50
-        $softDelete = isset($this->data['disable_soft_delete'])?$this->data['disable_soft_delete']:true;
51
-        if($softDelete === true && Schema::hasColumn($this->data['table'],'deleted_at')) {
50
+        $softDelete = isset($this->data['disable_soft_delete']) ? $this->data['disable_soft_delete'] : true;
51
+        if ($softDelete === true && Schema::hasColumn($this->data['table'], 'deleted_at')) {
52 52
             $query->whereNull($this->data['table'].'.deleted_at');
53 53
         }
54 54
         
55
-        if(isset($joins)) {
56
-            foreach($joins as $join)
55
+        if (isset($joins)) {
56
+            foreach ($joins as $join)
57 57
             {
58 58
                 $query->join($join['target_table'],
59 59
                         $join['target_table_primary'],
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
             }
64 64
         }
65 65
 
66
-        foreach($columns as $column) {
66
+        foreach ($columns as $column) {
67 67
             /** @var ColumnModel $column */
68
-            if($column->getType() != "custom") {
69
-                if(strpos($column->getField(),".") === false) {
70
-                    if(Schema::hasColumn($this->data['table'], $column->getField())) {
68
+            if ($column->getType() != "custom") {
69
+                if (strpos($column->getField(), ".") === false) {
70
+                    if (Schema::hasColumn($this->data['table'], $column->getField())) {
71 71
                         $query->addSelect($this->data['table'].'.'.$column->getField());
72 72
                     }
73
-                }else{
73
+                } else {
74 74
                     $query->addSelect($column->getField());
75 75
                 }
76 76
             }
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
             $query = getTypeHook($column->getType())->query($query, $column);
79 79
         }
80 80
 
81
-        if(request()->has('q'))
81
+        if (request()->has('q'))
82 82
         {
83
-            if(isset($this->data['hook_search_query'])) {
83
+            if (isset($this->data['hook_search_query'])) {
84 84
                 $query = call_user_func($this->data['hook_search_query'], $query);
85
-            }else{
86
-                $query->where(function ($where) use ($columns) {
85
+            } else {
86
+                $query->where(function($where) use ($columns) {
87 87
                     /**
88 88
                      * @var $where Builder
89 89
                      */
90
-                    foreach($columns as $column)
90
+                    foreach ($columns as $column)
91 91
                     {
92
-                        if(strpos($column->getField(),".") === false) {
92
+                        if (strpos($column->getField(), ".") === false) {
93 93
                             $field = $this->data['table'].'.'.$column->getField();
94
-                        }else{
94
+                        } else {
95 95
                             $field = $column->getField();
96 96
                         }
97 97
                         $where->orWhere($field, 'like', '%'.request('q').'%');
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
             }
101 101
         }
102 102
 
103
-        if(isset($this->data['hook_index_query']) && is_callable($this->data['hook_index_query'])) {
103
+        if (isset($this->data['hook_index_query']) && is_callable($this->data['hook_index_query'])) {
104 104
             $query = call_user_func($this->data['hook_index_query'], $query);
105 105
         }
106 106
 
107 107
 
108
-        if(request()->has(['order_by','order_sort']))
108
+        if (request()->has(['order_by', 'order_sort']))
109 109
         {
110
-            if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) {
110
+            if (in_array(request('order_by'), columnSingleton()->getColumnNameOnly())) {
111 111
                 $query->orderBy(request('order_by'), request('order_sort'));
112 112
             }
113
-        }else{
113
+        } else {
114 114
             $query->orderBy($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), "desc");
115 115
         }
116 116
 
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 
120 120
     public function getIndex()
121 121
     {
122
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
122
+        if (!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
123 123
 
124 124
         $query = $this->repository();
125
-        $result = $query->paginate( request("limit")?:cbConfig("LIMIT_TABLE_DATA") );
125
+        $result = $query->paginate(request("limit") ?: cbConfig("LIMIT_TABLE_DATA"));
126 126
         $data['result'] = $result;
127 127
 
128 128
         return view("crudbooster::module.index.index", array_merge($data, $this->data));
@@ -134,29 +134,29 @@  discard block
 block discarded – undo
134 134
      */
135 135
     private function validation()
136 136
     {
137
-        if(isset($this->data['validation'])) {
137
+        if (isset($this->data['validation'])) {
138 138
             $validator = Validator::make(request()->all(), @$this->data['validation'], @$this->data['validation_messages']);
139 139
             if ($validator->fails()) {
140 140
                 $message = $validator->messages();
141 141
                 $message_all = $message->all();
142
-                throw new CBValidationException(implode(', ',$message_all));
142
+                throw new CBValidationException(implode(', ', $message_all));
143 143
             }
144 144
         }
145 145
     }
146 146
 
147 147
     public function getAdd()
148 148
     {
149
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
149
+        if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
150 150
 
151 151
         $data = [];
152 152
         $data['page_title'] = $this->data['page_title'].' : Add';
153 153
         $data['action_url'] = module()->addSaveURL();
154
-        return view('crudbooster::module.form.form',array_merge($data, $this->data));
154
+        return view('crudbooster::module.form.form', array_merge($data, $this->data));
155 155
     }
156 156
 
157 157
     public function postAddSave()
158 158
     {
159
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
159
+        if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
160 160
 
161 161
         try {
162 162
             $this->validation();
@@ -164,28 +164,28 @@  discard block
 block discarded – undo
164 164
             $data = columnSingleton()->getAssignmentData();
165 165
 
166 166
             //Clear data from Primary Key
167
-            unset($data[ cb()->pk($this->data['table']) ]);
167
+            unset($data[cb()->pk($this->data['table'])]);
168 168
 
169
-            if(Schema::hasColumn($this->data['table'], 'created_at')) {
169
+            if (Schema::hasColumn($this->data['table'], 'created_at')) {
170 170
                 $data['created_at'] = date('Y-m-d H:i:s');
171 171
             }
172 172
 
173
-            if(isset($this->data['hook_before_insert']) && is_callable($this->data['hook_before_insert'])) {
173
+            if (isset($this->data['hook_before_insert']) && is_callable($this->data['hook_before_insert'])) {
174 174
                 $data = call_user_func($this->data['hook_before_insert'], $data);
175 175
             }
176 176
 
177 177
             $id = DB::table($this->data['table'])->insertGetId($data);
178 178
 
179
-            if(isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) {
179
+            if (isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) {
180 180
                 call_user_func($this->data['hook_after_insert'], $id);
181 181
             }
182 182
 
183 183
         } catch (CBValidationException $e) {
184 184
             Log::debug($e);
185
-            return cb()->redirectBack($e->getMessage(),'info');
185
+            return cb()->redirectBack($e->getMessage(), 'info');
186 186
         } catch (\Exception $e) {
187 187
             Log::error($e);
188
-            return cb()->redirectBack($e->getMessage(),'warning');
188
+            return cb()->redirectBack($e->getMessage(), 'warning');
189 189
         }
190 190
 
191 191
         if (request('submit') == trans('crudbooster.button_save_more')) {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
     public function getEdit($id)
199 199
     {
200
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
200
+        if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
201 201
 
202 202
         $data = [];
203 203
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
     public function postEditSave($id)
210 210
     {
211
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
211
+        if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
212 212
 
213 213
         try {
214 214
             $this->validation();
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
             $data = columnSingleton()->getAssignmentData();
217 217
 
218 218
             //Clear data from Primary Key
219
-            unset($data[ cb()->pk($this->data['table']) ]);
219
+            unset($data[cb()->pk($this->data['table'])]);
220 220
 
221
-            if(Schema::hasColumn($this->data['table'], 'updated_at')) {
221
+            if (Schema::hasColumn($this->data['table'], 'updated_at')) {
222 222
                 $data['updated_at'] = date('Y-m-d H:i:s');
223 223
             }
224 224
 
225
-            if(isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) {
225
+            if (isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) {
226 226
                 $data = call_user_func($this->data['hook_before_update'], $id, $data);
227 227
             }
228 228
 
@@ -230,16 +230,16 @@  discard block
 block discarded – undo
230 230
                 ->where(cb()->pk($this->data['table']), $id)
231 231
                 ->update($data);
232 232
 
233
-            if(isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) {
233
+            if (isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) {
234 234
                 call_user_func($this->data['hook_after_update'], $id);
235 235
             }
236 236
 
237 237
         } catch (CBValidationException $e) {
238 238
             Log::debug($e);
239
-            return cb()->redirectBack($e->getMessage(),'info');
239
+            return cb()->redirectBack($e->getMessage(), 'info');
240 240
         } catch (\Exception $e) {
241 241
             Log::error($e);
242
-            return cb()->redirectBack($e->getMessage(),'warning');
242
+            return cb()->redirectBack($e->getMessage(), 'warning');
243 243
         }
244 244
 
245 245
 
@@ -252,15 +252,15 @@  discard block
 block discarded – undo
252 252
 
253 253
     public function getDelete($id)
254 254
     {
255
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
255
+        if (!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
256 256
 
257
-        if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
257
+        if (isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
258 258
             call_user_func($this->data['hook_before_delete'], $id);
259 259
         }
260 260
 
261
-        $softDelete = isset($this->data['disable_soft_delete'])?$this->data['disable_soft_delete']:true;
261
+        $softDelete = isset($this->data['disable_soft_delete']) ? $this->data['disable_soft_delete'] : true;
262 262
 
263
-        if ($softDelete === true && Schema::hasColumn($this->data['table'],'deleted_at')) {
263
+        if ($softDelete === true && Schema::hasColumn($this->data['table'], 'deleted_at')) {
264 264
             DB::table($this->data['table'])
265 265
                 ->where(getPrimaryKey($this->data['table']), $id)
266 266
                 ->update(['deleted_at' => date('Y-m-d H:i:s')]);
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                 ->delete();
271 271
         }
272 272
 
273
-        if(isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) {
273
+        if (isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) {
274 274
             call_user_func($this->data['hook_after_delete'], $id);
275 275
         }
276 276
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
     public function getDetail($id)
281 281
     {
282
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area");
282
+        if (!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(), "You do not have a privilege access to this area");
283 283
 
284 284
         $data = [];
285 285
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
Please login to merge, or discard this patch.
src/CRUDBoosterServiceProvider.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
         // Register views
25 25
         $this->loadViewsFrom(__DIR__.'/views', 'crudbooster');
26 26
         $this->loadViewsFrom(__DIR__.'/types', 'types');
27
-        $this->loadTranslationsFrom(__DIR__."/localization","cb");
27
+        $this->loadTranslationsFrom(__DIR__."/localization", "cb");
28 28
 
29 29
         // Publish the files
30
-        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')],'cb_config');
31
-        $this->publishes([__DIR__.'/database' => base_path('database')],'cb_migration');
32
-        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')],'cb_hook');
33
-        $this->publishes([__DIR__ . '/assets' =>public_path('cb_asset')],'cb_asset');
30
+        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')], 'cb_config');
31
+        $this->publishes([__DIR__.'/database' => base_path('database')], 'cb_migration');
32
+        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')], 'cb_hook');
33
+        $this->publishes([__DIR__.'/assets' =>public_path('cb_asset')], 'cb_asset');
34 34
                     
35 35
         require __DIR__.'/validations/validation.php';        
36 36
         require __DIR__.'/routes.php';
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
         require __DIR__.'/helpers/Helper.php';
49 49
 
50 50
         // Singletons
51
-        $this->app->singleton('crudbooster', function ()
51
+        $this->app->singleton('crudbooster', function()
52 52
         {
53 53
             return true;
54 54
         });
55 55
         $this->app->singleton('ColumnSingleton', ColumnSingleton::class);
56 56
 
57 57
         // Merging configuration
58
-        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php','crudbooster');
58
+        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php', 'crudbooster');
59 59
 
60 60
 
61 61
         // Register Commands
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     private function registerTypeRoutes() {
79 79
         $routes = rglob(__DIR__.DIRECTORY_SEPARATOR."types".DIRECTORY_SEPARATOR."Route.php");
80
-        foreach($routes as $route) {
80
+        foreach ($routes as $route) {
81 81
             require $route;
82 82
         }
83 83
     }
Please login to merge, or discard this patch.
src/controllers/AdminAuthController.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
     public function getLogin()
10 10
     {
11
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
11
+        if (!auth()->guest()) return redirect(cb()->getAdminUrl());
12 12
 
13 13
         cbHook()->hookGetLogin();
14 14
 
@@ -17,20 +17,20 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function postLogin()
19 19
     {
20
-        try{
20
+        try {
21 21
             cb()->validation([
22 22
                 'email'=>'required|email',
23 23
                 'password'=>'required'
24 24
             ]);
25
-            $credential = request()->only(['email','password']);
25
+            $credential = request()->only(['email', 'password']);
26 26
             if (auth()->attempt($credential)) {
27 27
                 cbHook()->hookPostLogin();
28 28
                 return redirect(cb()->getAdminUrl());
29 29
             } else {
30
-                return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.password_and_username_is_wrong'),'message_type'=>'warning']);
30
+                return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.password_and_username_is_wrong'), 'message_type'=>'warning']);
31 31
             }
32
-        }catch (CBValidationException $e) {
33
-            return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
32
+        } catch (CBValidationException $e) {
33
+            return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning');
34 34
         }
35 35
     }
36 36
 
@@ -45,25 +45,25 @@  discard block
 block discarded – undo
45 45
     }
46 46
 
47 47
     public function postLoginDeveloper() {
48
-        try{
48
+        try {
49 49
             cb()->validation([
50 50
                 'username'=>'required',
51 51
                 'password'=>'required'
52 52
             ]);
53 53
 
54
-            if(request('username') == getSetting('developer_username')
54
+            if (request('username') == getSetting('developer_username')
55 55
                 && request('password') == getSetting("developer_password")) {
56 56
 
57 57
                 session(['developer'=>1]);
58 58
 
59 59
                 return redirect(cb()->getDeveloperUrl());
60 60
 
61
-            }else{
61
+            } else {
62 62
                 return cb()->redirectBack(__("crudbooster.password_and_username_is_wrong"));
63 63
             }
64 64
 
65
-        }catch (CBValidationException $e) {
66
-            return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
65
+        } catch (CBValidationException $e) {
66
+            return cb()->redirect(cb()->getLoginUrl(), $e->getMessage(), 'warning');
67 67
         }
68 68
     }
69 69
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 
9 9
     public function getLogin()
10 10
     {
11
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
11
+        if(!auth()->guest()) {
12
+            return redirect(cb()->getAdminUrl());
13
+        }
12 14
 
13 15
         cbHook()->hookGetLogin();
14 16
 
@@ -29,7 +31,7 @@  discard block
 block discarded – undo
29 31
             } else {
30 32
                 return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.password_and_username_is_wrong'),'message_type'=>'warning']);
31 33
             }
32
-        }catch (CBValidationException $e) {
34
+        } catch (CBValidationException $e) {
33 35
             return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
34 36
         }
35 37
     }
@@ -58,11 +60,11 @@  discard block
 block discarded – undo
58 60
 
59 61
                 return redirect(cb()->getDeveloperUrl());
60 62
 
61
-            }else{
63
+            } else{
62 64
                 return cb()->redirectBack(__("crudbooster.password_and_username_is_wrong"));
63 65
             }
64 66
 
65
-        }catch (CBValidationException $e) {
67
+        } catch (CBValidationException $e) {
66 68
             return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
67 69
         }
68 70
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperModulesController.php 2 patches
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
     public function getIndex() {
32 32
         $data = [];
33 33
         $data['result'] = DB::table("cb_modules")->get();
34
-        return view($this->view.'.index',$data);
34
+        return view($this->view.'.index', $data);
35 35
     }
36 36
 
37 37
     public function getAdd() {
38 38
         $data = [];
39 39
         $data['tables'] = cb()->listAllTable();
40
-        $data['module'] = (request('modules_id'))?cb()->find("cb_modules", request("modules_id")):null;
40
+        $data['module'] = (request('modules_id')) ?cb()->find("cb_modules", request("modules_id")) : null;
41 41
         return view($this->view.'.add', $data);
42 42
     }
43 43
 
@@ -50,17 +50,17 @@  discard block
 block discarded – undo
50 50
         $data = cb()->listAllColumns($table);
51 51
         $pk = cb()->findPrimaryKey($table);
52 52
         $result = [];
53
-        foreach($data as $item) {
53
+        foreach ($data as $item) {
54 54
 
55
-            if(Str::contains(strtolower($item),["title","name","label"])) {
55
+            if (Str::contains(strtolower($item), ["title", "name", "label"])) {
56 56
                 $display = true;
57
-            }else{
57
+            } else {
58 58
                 $display = false;
59 59
             }
60 60
 
61 61
             $result[] = [
62 62
                 "column"=>$item,
63
-                "primary_key"=>($pk==$item)?true:false,
63
+                "primary_key"=>($pk == $item) ?true:false,
64 64
                 "display"=>$display
65 65
             ];
66 66
         }
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 
70 70
     public function getColumns($table)
71 71
     {
72
-        if(request("modules_id")) {
73
-            $module = cb()->find("cb_modules",request("modules_id"));
74
-            if($module->last_column_build) {
72
+        if (request("modules_id")) {
73
+            $module = cb()->find("cb_modules", request("modules_id"));
74
+            if ($module->last_column_build) {
75 75
                 return response()->json(json_decode($module->last_column_build));
76 76
             }
77 77
         }
@@ -79,46 +79,46 @@  discard block
 block discarded – undo
79 79
         $columns = cb()->listAllColumns($table);
80 80
         $pk = cb()->findPrimaryKey($table);
81 81
         $result = [];
82
-        foreach($columns as $column) {
83
-            if($column != $pk) {
82
+        foreach ($columns as $column) {
83
+            if ($column != $pk) {
84 84
 
85 85
                 // Check if any relation table candidate
86 86
                 $optionTable = "";
87
-                if(Str::substr(strtolower($column),-3,3) == "_id") {
88
-                    $relationTable = Str::substr($column,0,-3);
89
-                    if(Schema::hasTable($relationTable)) {
87
+                if (Str::substr(strtolower($column), -3, 3) == "_id") {
88
+                    $relationTable = Str::substr($column, 0, -3);
89
+                    if (Schema::hasTable($relationTable)) {
90 90
                         $optionTable = $relationTable;
91 91
                     }
92
-                }elseif (Str::substr(strtolower($column),0,3) == "id_") {
93
-                    $relationTable = Str::substr($column,3);
94
-                    if(Schema::hasTable($relationTable)) {
92
+                }elseif (Str::substr(strtolower($column), 0, 3) == "id_") {
93
+                    $relationTable = Str::substr($column, 3);
94
+                    if (Schema::hasTable($relationTable)) {
95 95
                         $optionTable = $relationTable;
96 96
                     }
97 97
                 }
98 98
 
99
-                $label = trim(Str::title(str_replace(["id_","_id","_"]," ",$column)));
99
+                $label = trim(Str::title(str_replace(["id_", "_id", "_"], " ", $column)));
100 100
                 $label = Str::singular($label);
101 101
                 $type = "text";
102 102
 
103
-                if(Str::contains(strtolower($label),["photo","image","picture","gambar"])) {
103
+                if (Str::contains(strtolower($label), ["photo", "image", "picture", "gambar"])) {
104 104
                     $type = "image";
105
-                }elseif (Str::contains(strtolower($label),["email","mail"])) {
105
+                }elseif (Str::contains(strtolower($label), ["email", "mail"])) {
106 106
                     $type = "email";
107
-                }elseif (Str::contains(strtolower($label),["description","content","detail"])) {
108
-                    $type =  "wysiwyg";
109
-                }elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) {
107
+                }elseif (Str::contains(strtolower($label), ["description", "content", "detail"])) {
108
+                    $type = "wysiwyg";
109
+                }elseif (Str::contains(strtolower($label), ["price", "money", "grand_total", "tax"])) {
110 110
                     $type = "money";
111
-                }elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) {
111
+                }elseif (Str::contains(strtolower($label), ["quantity", "qty", "total", "phone", "telp"])) {
112 112
                     $type = "number";
113
-                }elseif (Str::contains(strtolower($label),["date"])) {
113
+                }elseif (Str::contains(strtolower($label), ["date"])) {
114 114
                     $type = "date";
115 115
                 }
116 116
 
117
-                if (Str::substr(strtolower($column),-3,3) == "_id") {
117
+                if (Str::substr(strtolower($column), -3, 3) == "_id") {
118 118
                     $type = "select_table";
119 119
                 } elseif (Str::substr($column, -3, 3) == "_at") {
120 120
                     $type = "datetime";
121
-                } elseif (Str::substr($column,0, 3) == "id_") {
121
+                } elseif (Str::substr($column, 0, 3) == "id_") {
122 122
                     $type = "select_table";
123 123
                 }
124 124
 
@@ -164,39 +164,39 @@  discard block
 block discarded – undo
164 164
     public function postCreateMigration()
165 165
     {
166 166
         try {
167
-            cb()->validation(['table_name','structures']);
167
+            cb()->validation(['table_name', 'structures']);
168 168
 
169 169
             $tableName = request("table_name");
170 170
 
171
-            if(!Schema::hasTable($tableName)) {
171
+            if (!Schema::hasTable($tableName)) {
172 172
                 $filenameMigration = date("Y_m_d_His")."_".$tableName.".php";
173 173
                 $createTemplate = file_get_contents(base_path("vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/create.stub"));
174 174
                 $className = Str::studly($tableName);
175 175
                 $createTemplate = str_replace("DummyClass", $className, $createTemplate);
176 176
                 $createTemplate = str_replace("DummyTable", $tableName, $createTemplate);
177
-                $createTemplate = str_replace("\$table->increments('id');","",$createTemplate);
177
+                $createTemplate = str_replace("\$table->increments('id');", "", $createTemplate);
178 178
 
179 179
                 $structureItems = "";
180 180
 
181
-                if(request("timestamp")) {
181
+                if (request("timestamp")) {
182 182
                     $structureItems .= "\$table->timestamps();\n\t\t\t";
183 183
                 }
184 184
 
185
-                if(request("soft_deletes")) {
185
+                if (request("soft_deletes")) {
186 186
                     $structureItems .= "\$table->softDeletes();\n\t\t\t";
187 187
                 }
188 188
 
189
-                foreach(request("structures") as $item) {
189
+                foreach (request("structures") as $item) {
190 190
 
191 191
                     $nullable = "";
192 192
 
193
-                    if(!in_array($item['type_data'],["bigIncrements","increments","mediumIncrements","smallIncrements"])) {
193
+                    if (!in_array($item['type_data'], ["bigIncrements", "increments", "mediumIncrements", "smallIncrements"])) {
194 194
                         $nullable = "->nullable()";
195 195
                     }
196 196
 
197
-                    if($item['length']) {
197
+                    if ($item['length']) {
198 198
                         $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."', ".$item['length'].")$nullable;\n\t\t\t";
199
-                    }else{
199
+                    } else {
200 200
                         $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."')$nullable;\n\t\t\t";
201 201
                     }
202 202
                 }
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
             }
216 216
 
217 217
         } catch (CBValidationException $e) {
218
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
218
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
219 219
         } catch (\Exception $e) {
220
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
220
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
221 221
         }
222 222
 
223
-        return response()->json(['status'=>true,'message'=>'Migration successfully!']);
223
+        return response()->json(['status'=>true, 'message'=>'Migration successfully!']);
224 224
     }
225 225
 
226 226
     public function postCheckExistModule()
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
         try {
229 229
             cb()->validation(['name', 'table']);
230 230
 
231
-            if(DB::table("cb_modules")->where("table_name",request("table"))->where("name",request("name"))->count()) {
231
+            if (DB::table("cb_modules")->where("table_name", request("table"))->where("name", request("name"))->count()) {
232 232
                 return response()->json(['status'=>true]);
233 233
             }
234 234
 
235 235
         } catch (CBValidationException $e) {
236
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
236
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
237 237
         }
238 238
 
239 239
         return response()->json(['status'=>false]);
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
     public function postAddSave() {
243 243
 
244 244
         try {
245
-            cb()->validation(['name', 'table','icon','columns']);
245
+            cb()->validation(['name', 'table', 'icon', 'columns']);
246 246
 
247 247
             $module = (new ModuleGenerator(request('table'), request('name'), request('icon'), request("columns"), request("rebuild")))->make();
248 248
 
249 249
         } catch (CBValidationException $e) {
250
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
250
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
251 251
         }
252 252
 
253 253
         return response()->json(['status'=>true, 'message'=>'Please remember that you can still modify the structure by edit the controller file '.$module['controller'].' :)']);
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
         try {
264 264
             cb()->validation(['name', 'icon']);
265 265
 
266
-            cb()->updateCompact("cb_modules", $id, ['name','icon']);
266
+            cb()->updateCompact("cb_modules", $id, ['name', 'icon']);
267 267
 
268
-            return cb()->redirect(route("DeveloperModulesControllerGetIndex"),"Module has been updated!","success");
268
+            return cb()->redirect(route("DeveloperModulesControllerGetIndex"), "Module has been updated!", "success");
269 269
 
270 270
         } catch (CBValidationException $e) {
271 271
             return cb()->redirectBack($e->getMessage());
@@ -273,18 +273,18 @@  discard block
 block discarded – undo
273 273
     }
274 274
 
275 275
     public function getDelete($id) {
276
-        $module = cb()->find("cb_modules",$id);
276
+        $module = cb()->find("cb_modules", $id);
277 277
         @unlink(app_path("Http/Controllers/".$module->controller.".php"));
278 278
         DB::table("cb_modules")->where("id", $id)->delete();
279 279
         DB::table("cb_menus")->where("cb_modules_id", $id)->delete();
280
-        return cb()->redirectBack("The module has been deleted!","success");
280
+        return cb()->redirectBack("The module has been deleted!", "success");
281 281
     }
282 282
 
283 283
     public function getDeleteSoft($id) {
284
-        $module = cb()->find("cb_modules",$id);
284
+        $module = cb()->find("cb_modules", $id);
285 285
         DB::table("cb_modules")->where("id", $id)->delete();
286 286
         DB::table("cb_menus")->where("cb_modules_id", $id)->delete();
287
-        return cb()->redirectBack("The module has been deleted!","success");
287
+        return cb()->redirectBack("The module has been deleted!", "success");
288 288
     }
289 289
 
290 290
 }
291 291
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
             if(Str::contains(strtolower($item),["title","name","label"])) {
56 56
                 $display = true;
57
-            }else{
57
+            } else{
58 58
                 $display = false;
59 59
             }
60 60
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                     if(Schema::hasTable($relationTable)) {
90 90
                         $optionTable = $relationTable;
91 91
                     }
92
-                }elseif (Str::substr(strtolower($column),0,3) == "id_") {
92
+                } elseif (Str::substr(strtolower($column),0,3) == "id_") {
93 93
                     $relationTable = Str::substr($column,3);
94 94
                     if(Schema::hasTable($relationTable)) {
95 95
                         $optionTable = $relationTable;
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
 
103 103
                 if(Str::contains(strtolower($label),["photo","image","picture","gambar"])) {
104 104
                     $type = "image";
105
-                }elseif (Str::contains(strtolower($label),["email","mail"])) {
105
+                } elseif (Str::contains(strtolower($label),["email","mail"])) {
106 106
                     $type = "email";
107
-                }elseif (Str::contains(strtolower($label),["description","content","detail"])) {
107
+                } elseif (Str::contains(strtolower($label),["description","content","detail"])) {
108 108
                     $type =  "wysiwyg";
109
-                }elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) {
109
+                } elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) {
110 110
                     $type = "money";
111
-                }elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) {
111
+                } elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) {
112 112
                     $type = "number";
113
-                }elseif (Str::contains(strtolower($label),["date"])) {
113
+                } elseif (Str::contains(strtolower($label),["date"])) {
114 114
                     $type = "date";
115 115
                 }
116 116
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
                     if($item['length']) {
198 198
                         $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."', ".$item['length'].")$nullable;\n\t\t\t";
199
-                    }else{
199
+                    } else{
200 200
                         $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."')$nullable;\n\t\t\t";
201 201
                     }
202 202
                 }
Please login to merge, or discard this patch.
src/controllers/DeveloperRolesController.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
     public function getIndex() {
26 26
         $data = [];
27 27
         $data['result'] = DB::table("cb_roles")->get();
28
-        return view($this->view.".index",$data);
28
+        return view($this->view.".index", $data);
29 29
     }
30 30
 
31 31
     public function getAdd() {
32 32
         $data = [];
33
-        $data['menus'] = DB::table("cb_menus")->orderBy("name","asc")->get();
33
+        $data['menus'] = DB::table("cb_menus")->orderBy("name", "asc")->get();
34 34
         return view($this->view.".add", $data);
35 35
     }
36 36
 
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
                 $privilege = [];
50 50
                 $privilege["cb_roles_id"] = $roles_id;
51 51
                 $privilege["cb_menus_id"] = $menus_id;
52
-                $privilege["can_browse"]  = @$access['can_browse']?:0;
53
-                $privilege["can_create"] = @$access['can_create']?:0;
54
-                $privilege["can_read"] = @$access['can_read']?:0;
55
-                $privilege["can_update"] = @$access['can_update']?:0;
56
-                $privilege["can_delete"] = @$access['can_delete']?:0;
52
+                $privilege["can_browse"]  = @$access['can_browse'] ?: 0;
53
+                $privilege["can_create"] = @$access['can_create'] ?: 0;
54
+                $privilege["can_read"] = @$access['can_read'] ?: 0;
55
+                $privilege["can_update"] = @$access['can_update'] ?: 0;
56
+                $privilege["can_delete"] = @$access['can_delete'] ?: 0;
57 57
                 DB::table("cb_role_privileges")->insert($privilege);
58 58
             }
59 59
 
60 60
             DB::commit();
61 61
 
62
-            return cb()->redirect(route("DeveloperRolesControllerGetIndex"),"The role has been saved!","success");
62
+            return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been saved!", "success");
63 63
 
64 64
         } catch (CBValidationException $e) {
65 65
             return cb()->redirectBack($e->getMessage());
@@ -74,21 +74,21 @@  discard block
 block discarded – undo
74 74
         $data['row'] = cb()->find("cb_roles", $id);
75 75
 
76 76
         $menus = DB::table("cb_menus")
77
-        ->leftjoin("cb_role_privileges",function($join) use ($id) {
78
-            $join->on("cb_role_privileges.cb_menus_id","=","cb_menus.id")->where("cb_role_privileges.cb_roles_id", $id);
77
+        ->leftjoin("cb_role_privileges", function($join) use ($id) {
78
+            $join->on("cb_role_privileges.cb_menus_id", "=", "cb_menus.id")->where("cb_role_privileges.cb_roles_id", $id);
79 79
         })
80
-        ->orderBy("cb_menus.name","asc")
81
-        ->select("cb_menus.*","can_browse","can_create","can_read","can_update","can_delete")
80
+        ->orderBy("cb_menus.name", "asc")
81
+        ->select("cb_menus.*", "can_browse", "can_create", "can_read", "can_update", "can_delete")
82 82
         ->get();
83 83
         $data['menus'] = $menus;
84 84
 
85
-        return view($this->view.".edit",$data);
85
+        return view($this->view.".edit", $data);
86 86
     }
87 87
 
88 88
     private function existsPrivilege($cb_roles_id, $cb_menus_id) {
89
-        if($row = cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id])) {
89
+        if ($row = cb()->find("cb_role_privileges", ['cb_roles_id'=>$cb_roles_id, 'cb_menus_id'=>$cb_menus_id])) {
90 90
             return $row->id;
91
-        }else{
91
+        } else {
92 92
             return null;
93 93
         }
94 94
     }
@@ -97,26 +97,26 @@  discard block
 block discarded – undo
97 97
         try {
98 98
             cb()->validation(['name', 'menus']);
99 99
 
100
-            cb()->updateCompact("cb_roles",$id,['name']);
100
+            cb()->updateCompact("cb_roles", $id, ['name']);
101 101
 
102 102
             foreach (request("menus") as $menus_id) {
103 103
                 @$access = request("access")[$menus_id];
104 104
                 $privilege = [];
105 105
                 $privilege["cb_roles_id"] = $id;
106 106
                 $privilege["cb_menus_id"] = $menus_id;
107
-                $privilege["can_browse"]  = @$access['can_browse']?:0;
108
-                $privilege["can_create"] = @$access['can_create']?:0;
109
-                $privilege["can_read"] = @$access['can_read']?:0;
110
-                $privilege["can_update"] = @$access['can_update']?:0;
111
-                $privilege["can_delete"] = @$access['can_delete']?:0;
112
-                if($privilege_id = $this->existsPrivilege($id, $menus_id)) {
107
+                $privilege["can_browse"]  = @$access['can_browse'] ?: 0;
108
+                $privilege["can_create"] = @$access['can_create'] ?: 0;
109
+                $privilege["can_read"] = @$access['can_read'] ?: 0;
110
+                $privilege["can_update"] = @$access['can_update'] ?: 0;
111
+                $privilege["can_delete"] = @$access['can_delete'] ?: 0;
112
+                if ($privilege_id = $this->existsPrivilege($id, $menus_id)) {
113 113
                     DB::table("cb_role_privileges")->where("id", $privilege_id)->update($privilege);
114
-                }else{
114
+                } else {
115 115
                     DB::table("cb_role_privileges")->insert($privilege);
116 116
                 }
117 117
             }
118 118
 
119
-            return cb()->redirect(route("DeveloperRolesControllerGetIndex"),"The role has been saved!","success");
119
+            return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been saved!", "success");
120 120
 
121 121
         } catch (CBValidationException $e) {
122 122
 
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 
127 127
     public function getDelete($id) {
128 128
         DB::table("cb_roles")->where("id", $id)->delete();
129
-        DB::table("cb_role_privileges")->where("cb_roles_id",$id)->delete();
129
+        DB::table("cb_role_privileges")->where("cb_roles_id", $id)->delete();
130 130
 
131
-        return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been deleted!","success");
131
+        return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been deleted!", "success");
132 132
     }
133 133
 
134 134
 }
135 135
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     private function existsPrivilege($cb_roles_id, $cb_menus_id) {
89 89
         if($row = cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id])) {
90 90
             return $row->id;
91
-        }else{
91
+        } else{
92 92
             return null;
93 93
         }
94 94
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 $privilege["can_delete"] = @$access['can_delete']?:0;
112 112
                 if($privilege_id = $this->existsPrivilege($id, $menus_id)) {
113 113
                     DB::table("cb_role_privileges")->where("id", $privilege_id)->update($privilege);
114
-                }else{
114
+                } else{
115 115
                     DB::table("cb_role_privileges")->insert($privilege);
116 116
                 }
117 117
             }
Please login to merge, or discard this patch.
src/controllers/scaffolding/traits/ColumnsRegister.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
         $data = new TextModel();
60 60
         $data = $this->setDefaultModelValue($data);
61 61
         $data->setLabel($label);
62
-        $data->setName($this->name($label,$name));
63
-        $data->setField($field_to_save?:$this->name($label, $name));
62
+        $data->setName($this->name($label, $name));
63
+        $data->setField($field_to_save ?: $this->name($label, $name));
64 64
         $data->setType("text");
65 65
 
66 66
         columnSingleton()->setColumn($this->index, $data);
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
         $data = new CheckboxModel();
76 76
         $data = $this->setDefaultModelValue($data);
77 77
         $data->setLabel($label);
78
-        $data->setName($this->name($label,$name));
79
-        $data->setField($field_to_save?:$this->name($label, $name));
78
+        $data->setName($this->name($label, $name));
79
+        $data->setField($field_to_save ?: $this->name($label, $name));
80 80
         $data->setType("checkbox");
81 81
 
82 82
         columnSingleton()->setColumn($this->index, $data);
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
         $data = new PasswordModel();
92 92
         $data = $this->setDefaultModelValue($data);
93 93
         $data->setLabel($label);
94
-        $data->setName($this->name($label,$name));
95
-        $data->setField($field_to_save?:$this->name($label, $name));
94
+        $data->setName($this->name($label, $name));
95
+        $data->setField($field_to_save ?: $this->name($label, $name));
96 96
         $data->setType("password");
97 97
         $data->setShowDetail(false);
98 98
         $data->setShowIndex(false);
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
         $data = new ImageModel();
110 110
         $data = $this->setDefaultModelValue($data);
111 111
         $data->setLabel($label);
112
-        $data->setName($this->name($label,$name));
113
-        $data->setField($field_to_save?:$this->name($label, $name));
112
+        $data->setName($this->name($label, $name));
113
+        $data->setField($field_to_save ?: $this->name($label, $name));
114 114
         $data->setType("image");
115 115
 
116 116
         columnSingleton()->setColumn($this->index, $data);
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
         $data = new TextAreaModel();
126 126
         $data = $this->setDefaultModelValue($data);
127 127
         $data->setLabel($label);
128
-        $data->setName($this->name($label,$name));
129
-        $data->setField($field_to_save?:$this->name($label, $name));
128
+        $data->setName($this->name($label, $name));
129
+        $data->setField($field_to_save ?: $this->name($label, $name));
130 130
         $data->setType("text_area");
131 131
 
132 132
         columnSingleton()->setColumn($this->index, $data);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $data = new SelectTableModel();
142 142
         $data = $this->setDefaultModelValue($data);
143 143
         $data->setLabel($label);
144
-        $data->setName($this->name($label,$name));
144
+        $data->setName($this->name($label, $name));
145 145
         $data->setField($this->name($label, $name));
146 146
         $data->setType("select_table");
147 147
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 
150 150
         $selectTable = new SelectTable($this->index);
151 151
 
152
-        if($selectConfig) {
153
-            $selectTable->optionsFromTable($selectConfig['table'],$selectConfig['value_option'],$selectConfig['display_option'],@$selectConfig['sql_condition']);
152
+        if ($selectConfig) {
153
+            $selectTable->optionsFromTable($selectConfig['table'], $selectConfig['value_option'], $selectConfig['display_option'], @$selectConfig['sql_condition']);
154 154
         }
155 155
 
156 156
         return $selectTable;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         $data = new SelectOptionModel();
164 164
         $data = $this->setDefaultModelValue($data);
165 165
         $data->setLabel($label);
166
-        $data->setName($this->name($label,$name));
166
+        $data->setName($this->name($label, $name));
167 167
         $data->setField($this->name($label, $name));
168 168
         $data->setType("select_option");
169 169
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
         $selectOption = new SelectOption($this->index);
173 173
 
174
-        if($options) {
174
+        if ($options) {
175 175
             $selectOption->options($options);
176 176
         }
177 177
 
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
         $data = new SelectQueryModel();
192 192
         $data = $this->setDefaultModelValue($data);
193 193
         $data->setLabel($label);
194
-        $data->setName($this->name($label,$name));
194
+        $data->setName($this->name($label, $name));
195 195
         $data->setField($this->name($label, $name));
196 196
         $data->setType("select_query");
197 197
 
198 198
         columnSingleton()->setColumn($this->index, $data);
199 199
 
200
-        $selectQuery =new SelectQuery($this->index);
200
+        $selectQuery = new SelectQuery($this->index);
201 201
 
202
-        if($query) {
202
+        if ($query) {
203 203
             $selectQuery->optionsFromQuery($query);
204 204
         }
205 205
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
         $data = new CustomModel();
215 215
         $data = $this->setDefaultModelValue($data);
216 216
         $data->setLabel($label);
217
-        $data->setName($this->name($label,$name));
218
-        $data->setField($field_to_save?:$this->name($label, $name));
217
+        $data->setName($this->name($label, $name));
218
+        $data->setField($field_to_save ?: $this->name($label, $name));
219 219
         $data->setType("custom");
220 220
 
221 221
         columnSingleton()->setColumn($this->index, $data);
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
         $data = new DateModel();
231 231
         $data = $this->setDefaultModelValue($data);
232 232
         $data->setLabel($label);
233
-        $data->setName($this->name($label,$name));
234
-        $data->setField($field_to_save?:$this->name($label, $name));
233
+        $data->setName($this->name($label, $name));
234
+        $data->setField($field_to_save ?: $this->name($label, $name));
235 235
         $data->setType("date");
236 236
 
237 237
         columnSingleton()->setColumn($this->index, $data);
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
         $data = new DatetimeModel();
247 247
         $data = $this->setDefaultModelValue($data);
248 248
         $data->setLabel($label);
249
-        $data->setName($this->name($label,$name));
250
-        $data->setField($field_to_save?:$this->name($label, $name));
249
+        $data->setName($this->name($label, $name));
250
+        $data->setField($field_to_save ?: $this->name($label, $name));
251 251
         $data->setType("datetime");
252 252
 
253 253
         columnSingleton()->setColumn($this->index, $data);
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
         $data = new EmailModel();
263 263
         $data = $this->setDefaultModelValue($data);
264 264
         $data->setLabel($label);
265
-        $data->setName($this->name($label,$name));
266
-        $data->setField($field_to_save?:$this->name($label, $name));
265
+        $data->setName($this->name($label, $name));
266
+        $data->setField($field_to_save ?: $this->name($label, $name));
267 267
         $data->setType("email");
268 268
 
269 269
         columnSingleton()->setColumn($this->index, $data);
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
         $data = new FileModel();
279 279
         $data = $this->setDefaultModelValue($data);
280 280
         $data->setLabel($label);
281
-        $data->setName($this->name($label,$name));
282
-        $data->setField($field_to_save?:$this->name($label, $name));
281
+        $data->setName($this->name($label, $name));
282
+        $data->setField($field_to_save ?: $this->name($label, $name));
283 283
         $data->setType("file");
284 284
 
285 285
         columnSingleton()->setColumn($this->index, $data);
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
         $data = new HiddenModel();
296 296
         $data = $this->setDefaultModelValue($data);
297 297
         $data->setLabel($label);
298
-        $data->setName($this->name($label,$name));
299
-        $data->setField($field_to_save?:$this->name($label, $name));
298
+        $data->setName($this->name($label, $name));
299
+        $data->setField($field_to_save ?: $this->name($label, $name));
300 300
         $data->setType("hidden");
301 301
 
302 302
         columnSingleton()->setColumn($this->index, $data);
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
         $data = new NumberModel();
312 312
         $data = $this->setDefaultModelValue($data);
313 313
         $data->setLabel($label);
314
-        $data->setName($this->name($label,$name));
315
-        $data->setField($field_to_save?:$this->name($label, $name));
314
+        $data->setName($this->name($label, $name));
315
+        $data->setField($field_to_save ?: $this->name($label, $name));
316 316
         $data->setType("number");
317 317
 
318 318
         columnSingleton()->setColumn($this->index, $data);
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
         $data = new MoneyModel();
328 328
         $data = $this->setDefaultModelValue($data);
329 329
         $data->setLabel($label);
330
-        $data->setName($this->name($label,$name));
331
-        $data->setField($field_to_save?:$this->name($label, $name));
330
+        $data->setName($this->name($label, $name));
331
+        $data->setField($field_to_save ?: $this->name($label, $name));
332 332
         $data->setType("money");
333 333
 
334 334
         columnSingleton()->setColumn($this->index, $data);
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
         $data = new RadioModel();
344 344
         $data = $this->setDefaultModelValue($data);
345 345
         $data->setLabel($label);
346
-        $data->setName($this->name($label,$name));
347
-        $data->setField($field_to_save?:$this->name($label, $name));
346
+        $data->setName($this->name($label, $name));
347
+        $data->setField($field_to_save ?: $this->name($label, $name));
348 348
         $data->setType("radio");
349 349
 
350 350
         columnSingleton()->setColumn($this->index, $data);
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
         $data = new WysiwygModel();
360 360
         $data = $this->setDefaultModelValue($data);
361 361
         $data->setLabel($label);
362
-        $data->setName($this->name($label,$name));
363
-        $data->setField($field_to_save?:$this->name($label, $name));
362
+        $data->setName($this->name($label, $name));
363
+        $data->setField($field_to_save ?: $this->name($label, $name));
364 364
         $data->setType("wysiwyg");
365 365
 
366 366
         columnSingleton()->setColumn($this->index, $data);
Please login to merge, or discard this patch.
src/helpers/ModuleGenerator.php 2 patches
Spacing   +27 added lines, -27 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,42 +53,42 @@  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
 
73 73
             $methodName = Str::studly($field['column_type']);
74
-            if($label && $column) {
75
-                if(in_array($field['column_type'],['radio','select_option','checkbox'])) {
76
-                    if($options) {
74
+            if ($label && $column) {
75
+                if (in_array($field['column_type'], ['radio', 'select_option', 'checkbox'])) {
76
+                    if ($options) {
77 77
                         $optResult = [];
78
-                        foreach($options as $opt) {
78
+                        foreach ($options as $opt) {
79 79
                             $optResult[$opt['key']] = $opt['label'];
80 80
                         }
81
-                        $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '")->options('.min_var_export($optResult).')' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
81
+                        $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")->options('.min_var_export($optResult).')'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t";
82 82
                     }
83
-                }elseif (in_array($field['column_type'],['radio_table','select_table'])) {
83
+                }elseif (in_array($field['column_type'], ['radio_table', 'select_table'])) {
84 84
                     if ($optionTable && $optionValue && $optionDisplay) {
85
-                        $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '",["table"=>"' . $optionTable . '","value_option"=>"' . $optionValue . '","display_option"=>"' . $optionDisplay . '","sql_condition"=>"' . $optionSqlCondition . '"])' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
85
+                        $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'",["table"=>"'.$optionTable.'","value_option"=>"'.$optionValue.'","display_option"=>"'.$optionDisplay.'","sql_condition"=>"'.$optionSqlCondition.'"])'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t";
86 86
                     }
87 87
                 }elseif ($field['column_type'] == "select_query") {
88
-                    if($sqlRawQuery && Str::contains($sqlRawQuery,["as `key`","as `label`"])) {
89
-                        $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '","'.$sqlRawQuery.'")' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
88
+                    if ($sqlRawQuery && Str::contains($sqlRawQuery, ["as `key`", "as `label`"])) {
89
+                        $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'","'.$sqlRawQuery.'")'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t";
90 90
                     }
91
-                }else{
91
+                } else {
92 92
                     $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t";
93 93
                 }
94 94
             }
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
         $module['controller'] = $filename;
112 112
         $module['last_column_build'] = json_encode($this->columns);
113 113
 
114
-        if($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name",$this->table)->first()) {
115
-            DB::table("cb_modules")->where("id",$moduleData->id)->update($module);
114
+        if ($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name", $this->table)->first()) {
115
+            DB::table("cb_modules")->where("id", $moduleData->id)->update($module);
116 116
             $id_modules = $moduleData->id;
117
-        }else{
117
+        } else {
118 118
             $id_modules = DB::table('cb_modules')->insertGetId($module);
119 119
         }
120 120
 
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
         $menu['name'] = $module['name'];
124 124
         $menu['type'] = 'module';
125 125
         $menu['cb_modules_id'] = $id_modules;
126
-        if(isset($moduleData)) {
127
-            DB::table("cb_menus")->where("cb_modules_id",$moduleData->id)->update($menu);
128
-        }else{
126
+        if (isset($moduleData)) {
127
+            DB::table("cb_menus")->where("cb_modules_id", $moduleData->id)->update($menu);
128
+        } else {
129 129
             DB::table('cb_menus')->insertGetId($menu);
130 130
         }
131 131
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
                         }
81 81
                         $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '")->options('.min_var_export($optResult).')' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
82 82
                     }
83
-                }elseif (in_array($field['column_type'],['radio_table','select_table'])) {
83
+                } elseif (in_array($field['column_type'],['radio_table','select_table'])) {
84 84
                     if ($optionTable && $optionValue && $optionDisplay) {
85 85
                         $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '",["table"=>"' . $optionTable . '","value_option"=>"' . $optionValue . '","display_option"=>"' . $optionDisplay . '","sql_condition"=>"' . $optionSqlCondition . '"])' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
86 86
                     }
87
-                }elseif ($field['column_type'] == "select_query") {
87
+                } elseif ($field['column_type'] == "select_query") {
88 88
                     if($sqlRawQuery && Str::contains($sqlRawQuery,["as `key`","as `label`"])) {
89 89
                         $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '","'.$sqlRawQuery.'")' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
90 90
                     }
91
-                }else{
91
+                } else{
92 92
                     $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t";
93 93
                 }
94 94
             }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         if($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name",$this->table)->first()) {
115 115
             DB::table("cb_modules")->where("id",$moduleData->id)->update($module);
116 116
             $id_modules = $moduleData->id;
117
-        }else{
117
+        } else{
118 118
             $id_modules = DB::table('cb_modules')->insertGetId($module);
119 119
         }
120 120
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         $menu['cb_modules_id'] = $id_modules;
126 126
         if(isset($moduleData)) {
127 127
             DB::table("cb_menus")->where("cb_modules_id",$moduleData->id)->update($menu);
128
-        }else{
128
+        } else{
129 129
             DB::table('cb_menus')->insertGetId($menu);
130 130
         }
131 131
 
Please login to merge, or discard this patch.
src/commands/DeveloperCommandService.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@
 block discarded – undo
23 23
 
24 24
     public function create()
25 25
     {
26
-        if($this->command->)
27
-        if($this->command->option("password") == "AUTO") {
26
+        if ($this->command->)
27
+        if ($this->command->option("password") == "AUTO") {
28 28
             $password = Str::random(16);
29
-        }else{
29
+        } else {
30 30
             $password = $this->command->option("password");
31 31
         }
32 32
 
33
-        if($this->command->option("username") == "AUTO") {
33
+        if ($this->command->option("username") == "AUTO") {
34 34
             $username = Str::random(5);
35
-        }else{
35
+        } else {
36 36
             $username = $this->command->option("username");
37 37
         }
38 38
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,16 +23,17 @@
 block discarded – undo
23 23
 
24 24
     public function create()
25 25
     {
26
-        if($this->command->)
27
-        if($this->command->option("password") == "AUTO") {
26
+        if($this->command->) {
27
+                if($this->command->option("password") == "AUTO") {
28 28
             $password = Str::random(16);
29
-        }else{
29
+        }
30
+        } else{
30 31
             $password = $this->command->option("password");
31 32
         }
32 33
 
33 34
         if($this->command->option("username") == "AUTO") {
34 35
             $username = Str::random(5);
35
-        }else{
36
+        } else{
36 37
             $username = $this->command->option("username");
37 38
         }
38 39
 
Please login to merge, or discard this patch.
src/types/select_option/SelectOption.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@
 block discarded – undo
21 21
     public function options($data_options) {
22 22
         $data = columnSingleton()->getColumn($this->index);
23 23
 
24
-        foreach($data_options as $key=>$option) {
25
-            if(is_int($key)) {
24
+        foreach ($data_options as $key=>$option) {
25
+            if (is_int($key)) {
26 26
                 $data_options[$option] = $option;
27
-            }else{
27
+            } else {
28 28
                 $data_options[$key] = $option;
29 29
             }
30 30
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
         foreach($data_options as $key=>$option) {
25 25
             if(is_int($key)) {
26 26
                 $data_options[$option] = $option;
27
-            }else{
27
+            } else{
28 28
                 $data_options[$key] = $option;
29 29
             }
30 30
         }
Please login to merge, or discard this patch.