Passed
Push — master ( a5af1f...b86701 )
by Ferry
03:55
created
src/controllers/scaffolding/traits/ColumnsBasic.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
     private function name($label, $name = null)
20 20
     {
21
-        return (!$name)?strtolower(slug($label,"_")):$name;
21
+        return (!$name) ?strtolower(slug($label, "_")) : $name;
22 22
     }
23 23
 
24 24
     /**
Please login to merge, or discard this patch.
src/controllers/scaffolding/singletons/ColumnSingleton.php 1 patch
Spacing   +22 added lines, -22 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
             /** @var ColumnModel $column */
45
-            if($data_row) {
45
+            if ($data_row) {
46 46
                 $value = $data_row->{ $column->getField() };
47
-            }else{
47
+            } else {
48 48
                 $value = request($column->getName());
49 49
             }
50 50
 
51
-            if (! $column->getName()) {
51
+            if (!$column->getName()) {
52 52
                 continue;
53 53
             }
54 54
 
55
-            if(!$value && $column->getDefaultValue()) {
55
+            if (!$value && $column->getDefaultValue()) {
56 56
                 $value = $column->getDefaultValue();
57 57
             }
58 58
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
     public function getIndexColumns()
68 68
     {
69 69
         $data = $this->columns;
70
-        foreach($data as $i=>$item) {
70
+        foreach ($data as $i=>$item) {
71 71
             /** @var ColumnModel $item */
72
-            if($item->getShowIndex() === false) {
72
+            if ($item->getShowIndex() === false) {
73 73
                 unset($data[$i]);
74 74
             }
75 75
         }
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
     public function getAddEditColumns()
80 80
     {
81 81
         $data = $this->columns;
82
-        foreach($data as $i=>$item) {
82
+        foreach ($data as $i=>$item) {
83 83
             /** @var ColumnModel $item */
84
-            if($item->getShowIndex() === false) {
84
+            if ($item->getShowIndex() === false) {
85 85
                 unset($data[$i]);
86 86
             }
87 87
 
88
-            if($item->getShowDetail() === false) {
88
+            if ($item->getShowDetail() === false) {
89 89
                 unset($data[$i]);
90 90
             }
91 91
 
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
     public function getEditColumns()
97 97
     {
98 98
         $data = $this->columns;
99
-        foreach($data as $i=>$item) {
99
+        foreach ($data as $i=>$item) {
100 100
             /** @var ColumnModel $item */
101
-            if($item->getShowEdit() === false) {
101
+            if ($item->getShowEdit() === false) {
102 102
                 unset($data[$i]);
103 103
             }
104 104
         }
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
     public function getAddColumns()
109 109
     {
110 110
         $data = $this->columns;
111
-        foreach($data as $i=>$item) {
111
+        foreach ($data as $i=>$item) {
112 112
             /** @var ColumnModel $item */
113
-            if($item->getShowAdd() === false) {
113
+            if ($item->getShowAdd() === false) {
114 114
                 unset($data[$i]);
115 115
             }
116 116
         }
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
     public function getDetailColumns()
121 121
     {
122 122
         $data = $this->columns;
123
-        foreach($data as $i=>$item) {
123
+        foreach ($data as $i=>$item) {
124 124
             /** @var ColumnModel $item */
125
-            if($item->getShowDetail() === false) {
125
+            if ($item->getShowDetail() === false) {
126 126
                 unset($data[$i]);
127 127
             }
128 128
         }
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
     public function getAssignmentData()
133 133
     {
134 134
         $data = [];
135
-        foreach($this->columns as $column) {
135
+        foreach ($this->columns as $column) {
136 136
             /** @var ColumnModel $column */
137
-            if(is_array($column->getValue())) {
138
-                foreach($column->getValue() as $key=>$val) {
137
+            if (is_array($column->getValue())) {
138
+                foreach ($column->getValue() as $key=>$val) {
139 139
                     $data[$key] = $val;
140 140
                 }
141
-            }else{
141
+            } else {
142 142
                 $data[$column->getField()] = $column->getValue();
143 143
             }
144 144
         }
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
     public function removeColumn($label_or_name)
149 149
     {
150 150
         $data = $this->getColumns();
151
-        foreach($data as $i=>$d)
151
+        foreach ($data as $i=>$d)
152 152
         {
153 153
             /** @var ColumnModel $d */
154
-            if($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) {
154
+            if ($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) {
155 155
                 unset($data[$i]);
156 156
             }
157 157
         }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     public function getColumnNameOnly()
162 162
     {
163 163
         $result = [];
164
-        foreach($this->columns as $column) {
164
+        foreach ($this->columns as $column) {
165 165
             /** @var ColumnModel $column */
166 166
             $result[] = $column->getName();
167 167
         }
Please login to merge, or discard this patch.
src/controllers/DeveloperDashboardController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     public function getIndex() {
16 16
         $data = [];
17 17
         $data['page_title'] = "Dashboard";
18
-        return view('crudbooster::dev_layouts.modules.dashboard',$data);
18
+        return view('crudbooster::dev_layouts.modules.dashboard', $data);
19 19
     }
20 20
     
21 21
 
Please login to merge, or discard this patch.
src/controllers/DeveloperModulesController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     public function getIndex() {
27 27
         $data = [];
28 28
         $data['result'] = DB::table("cb_modules")->get();
29
-        return view($this->view.'.index',$data);
29
+        return view($this->view.'.index', $data);
30 30
     }
31 31
 
32 32
     public function getAdd() {
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function postAddSave() {
39 39
         try {
40
-            cb()->validation(['name', 'table','icon']);
40
+            cb()->validation(['name', 'table', 'icon']);
41 41
 
42 42
             (new ModuleGenerator(request('table'), request('name'), request('icon')))->make();
43 43
 
44
-            return cb()->redirect(route("DeveloperModulesControllerGetIndex"),"New module has been created!","success");
44
+            return cb()->redirect(route("DeveloperModulesControllerGetIndex"), "New module has been created!", "success");
45 45
 
46 46
         } catch (CBValidationException $e) {
47 47
             return cb()->redirectBack($e->getMessage());
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
         try {
59 59
             cb()->validation(['name', 'icon']);
60 60
 
61
-            cb()->updateCompact("cb_modules", $id, ['name','icon']);
61
+            cb()->updateCompact("cb_modules", $id, ['name', 'icon']);
62 62
 
63
-            return cb()->redirect(route("DeveloperModulesControllerGetIndex"),"Module has been updated!","success");
63
+            return cb()->redirect(route("DeveloperModulesControllerGetIndex"), "Module has been updated!", "success");
64 64
 
65 65
         } catch (CBValidationException $e) {
66 66
             return cb()->redirectBack($e->getMessage());
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     public function getDelete($id) {
71
-        $module = cb()->find("cb_modules",$id);
71
+        $module = cb()->find("cb_modules", $id);
72 72
         @unlink(app_path("Http/Controllers/".$module->controller));
73 73
         DB::table("cb_modules")->where("id", $id)->delete();
74 74
         DB::table("cb_menus")->where("cb_modules_id", $id)->delete();
75 75
 
76
-        return cb()->redirectBack("The module has been deleted!","success");
76
+        return cb()->redirectBack("The module has been deleted!", "success");
77 77
     }
78 78
 
79 79
 }
80 80
\ No newline at end of file
Please login to merge, or discard this patch.
src/controllers/AdminAuthController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
     public function getLogin()
9 9
     {
10
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
10
+        if (!auth()->guest()) return redirect(cb()->getAdminUrl());
11 11
 
12 12
         cbHook()->hookGetLogin();
13 13
 
@@ -16,20 +16,20 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function postLogin()
18 18
     {
19
-        try{
19
+        try {
20 20
             cb()->validation([
21 21
                 'email'=>'required|email',
22 22
                 'password'=>'required'
23 23
             ]);
24
-            $credential = request()->only(['email','password']);
24
+            $credential = request()->only(['email', 'password']);
25 25
             if (auth()->attempt($credential)) {
26 26
                 cbHook()->hookPostLogin();
27 27
                 return redirect(cb()->getAdminUrl());
28 28
             } else {
29
-                return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'),'message_type'=>'warning']);
29
+                return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'), 'message_type'=>'warning']);
30 30
             }
31
-        }catch (CBValidationException $e) {
32
-            return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
31
+        } catch (CBValidationException $e) {
32
+            return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning');
33 33
         }
34 34
     }
35 35
 
@@ -44,25 +44,25 @@  discard block
 block discarded – undo
44 44
     }
45 45
 
46 46
     public function postLoginDeveloper() {
47
-        try{
47
+        try {
48 48
             cb()->validation([
49 49
                 'username'=>'required',
50 50
                 'password'=>'required'
51 51
             ]);
52 52
 
53
-            if(request('username') == config('crudbooster.DEV_USERNAME')
53
+            if (request('username') == config('crudbooster.DEV_USERNAME')
54 54
                 && request('password') == config('crudbooster.DEV_PASSWORD')) {
55 55
 
56 56
                 session(['developer'=>1]);
57 57
 
58 58
                 return redirect(cb()->getDeveloperUrl());
59 59
 
60
-            }else{
60
+            } else {
61 61
                 return cb()->redirectBack("Username and or password is wrong!");
62 62
             }
63 63
 
64
-        }catch (CBValidationException $e) {
65
-            return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
64
+        } catch (CBValidationException $e) {
65
+            return cb()->redirect(cb()->getLoginUrl(), $e->getMessage(), 'warning');
66 66
         }
67 67
     }
68 68
 
Please login to merge, or discard this patch.
src/helpers/Helper.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 |
10 10
 */
11 11
 
12
-if(!function_exists('convertPHPToMomentFormat')) {
12
+if (!function_exists('convertPHPToMomentFormat')) {
13 13
     function convertPHPToMomentFormat($format)
14 14
     {
15 15
         $replacements = [
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
     }
57 57
 }
58 58
 
59
-if(!function_exists('slug')) {
59
+if (!function_exists('slug')) {
60 60
     function slug($string, $separator = '-') {
61 61
         return \Illuminate\Support\Str::slug($string, $separator);
62 62
     }
63 63
 }
64 64
 
65
-if(!function_exists('columnSingleton')) {
65
+if (!function_exists('columnSingleton')) {
66 66
     /**
67 67
      * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton
68 68
      */
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     }
72 72
 }
73 73
 
74
-if(!function_exists('cbHook'))
74
+if (!function_exists('cbHook'))
75 75
 {
76 76
     /**
77 77
      * @return crocodicstudio\crudbooster\hooks\CBHook
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     }
84 84
 }
85 85
 
86
-if(!function_exists('getTypeHook'))
86
+if (!function_exists('getTypeHook'))
87 87
 {
88 88
     /**
89 89
      * @param string $type
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     }
97 97
 }
98 98
 
99
-if(!function_exists('getPrimaryKey'))
99
+if (!function_exists('getPrimaryKey'))
100 100
 {
101 101
     function getPrimaryKey($table_name)
102 102
     {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     }
105 105
 }
106 106
 
107
-if(!function_exists('cb'))
107
+if (!function_exists('cb'))
108 108
 {
109 109
     function cb()
110 110
     {
@@ -112,25 +112,25 @@  discard block
 block discarded – undo
112 112
     }
113 113
 }
114 114
 
115
-if(!function_exists('cbAsset')) {
115
+if (!function_exists('cbAsset')) {
116 116
     function cbAsset($path) {
117 117
         return asset("cb_asset/".$path);
118 118
     }
119 119
 }
120 120
 
121
-if(!function_exists("cbConfig")) {
121
+if (!function_exists("cbConfig")) {
122 122
     function cbConfig($name) {
123 123
         return config("crudbooster.".$name);
124 124
     }
125 125
 }
126 126
 
127
-if(!function_exists("strRandom")) {
127
+if (!function_exists("strRandom")) {
128 128
     function strRandom($length = 5) {
129 129
         return \Illuminate\Support\Str::random($length);
130 130
     }
131 131
 }
132 132
 
133
-if(!function_exists('module')) {
133
+if (!function_exists('module')) {
134 134
     function module()
135 135
     {
136 136
         $module = new \crocodicstudio\crudbooster\helpers\Module();
@@ -138,43 +138,43 @@  discard block
 block discarded – undo
138 138
     }
139 139
 }
140 140
 
141
-if(!function_exists('getAdminLoginURL')) {
141
+if (!function_exists('getAdminLoginURL')) {
142 142
     function getAdminLoginURL()
143 143
     {
144 144
         return url(config('crudbooster.ADMIN_LOGIN_PATH'));
145 145
     }
146 146
 }
147 147
 
148
-if(!function_exists('dummyPhoto')) {
148
+if (!function_exists('dummyPhoto')) {
149 149
     function dummyPhoto()
150 150
     {
151 151
         return config('crudbooster.DUMMY_PHOTO');
152 152
     }
153 153
 }
154 154
 
155
-if(!function_exists('assetThumbnail')) {
155
+if (!function_exists('assetThumbnail')) {
156 156
 	function assetThumbnail($path) {
157
-		$path = str_replace('uploads/','uploads_thumbnail/',$path);
157
+		$path = str_replace('uploads/', 'uploads_thumbnail/', $path);
158 158
 		return asset($path);
159 159
 	}
160 160
 }
161 161
 
162
-if(!function_exists('assetResize')) {
163
-	function assetResize($path,$width,$height=null,$quality=70) {
162
+if (!function_exists('assetResize')) {
163
+	function assetResize($path, $width, $height = null, $quality = 70) {
164 164
 		$basename = basename($path);
165 165
 	    $pathWithoutName = str_replace($basename, '', $path);
166 166
 	    $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
167
-	    if(Storage::exists($newLocation)) {
167
+	    if (Storage::exists($newLocation)) {
168 168
 	        return asset($newLocation);
169
-	    }else{
170
-	        $img = Image::make(storage_path($path))->fit($width,$height);
171
-	        $img->save(storage_path($newLocation),$quality);
169
+	    } else {
170
+	        $img = Image::make(storage_path($path))->fit($width, $height);
171
+	        $img->save(storage_path($newLocation), $quality);
172 172
 	        return asset($newLocation);
173 173
 	    }
174 174
 	}
175 175
 }
176 176
 
177
-if(!function_exists('extract_unit')) {	
177
+if (!function_exists('extract_unit')) {	
178 178
 	/*
179 179
 	Credits: Bit Repository
180 180
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 }
193 193
 
194 194
 
195
-if(!function_exists('now')) {
195
+if (!function_exists('now')) {
196 196
 	function now() {		
197 197
 		return date('Y-m-d H:i:s');
198 198
 	}
@@ -206,13 +206,13 @@  discard block
 block discarded – undo
206 206
 |
207 207
 */
208 208
 
209
-if(!function_exists('putSetting')) {
209
+if (!function_exists('putSetting')) {
210 210
     function putSetting($key, $value)
211 211
     {
212
-        if(file_exists(storage_path('.cbconfig'))) {
212
+        if (file_exists(storage_path('.cbconfig'))) {
213 213
             $settings = file_get_contents(storage_path('.cbconfig'));
214 214
             $settings = unserialize($settings);
215
-        }else{
215
+        } else {
216 216
             $settings = [];
217 217
         }
218 218
 
@@ -223,25 +223,25 @@  discard block
 block discarded – undo
223 223
     }
224 224
 }
225 225
 
226
-if(!function_exists('getSetting')) {
226
+if (!function_exists('getSetting')) {
227 227
     function getSetting($key, $default = null)
228 228
     {
229
-        if(file_exists(storage_path('.cbconfig'))) {
229
+        if (file_exists(storage_path('.cbconfig'))) {
230 230
             $settings = file_get_contents(storage_path('.cbconfig'));
231 231
             $settings = unserialize($settings);
232
-        }else{
232
+        } else {
233 233
             $settings = [];
234 234
         }
235 235
 
236
-        if(isset($settings[$key])) {
237
-            return $settings[$key]?:$default;
238
-        }else{
236
+        if (isset($settings[$key])) {
237
+            return $settings[$key] ?: $default;
238
+        } else {
239 239
             return $default;
240 240
         }
241 241
     }
242 242
 }
243 243
 
244
-if(!function_exists('timeAgo')) {
244
+if (!function_exists('timeAgo')) {
245 245
     function timeAgo($datetime_to, $datetime_from = null, $full = false)
246 246
     {
247 247
         $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             }
273 273
         }
274 274
 
275
-        if (! $full) {
275
+        if (!$full) {
276 276
             $string = array_slice($string, 0, 1);
277 277
         }
278 278
 
@@ -280,22 +280,22 @@  discard block
 block discarded – undo
280 280
     }
281 281
 }
282 282
 
283
-if(!function_exists("array_map_r")) {
284
-    function array_map_r( $func, $arr )
283
+if (!function_exists("array_map_r")) {
284
+    function array_map_r($func, $arr)
285 285
     {
286 286
         $newArr = array();
287 287
 
288
-        foreach( $arr as $key => $value )
288
+        foreach ($arr as $key => $value)
289 289
         {
290 290
             $key = $func($key);
291
-            $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) );
291
+            $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value)));
292 292
         }
293 293
 
294 294
         return $newArr;
295 295
     }
296 296
 }
297 297
 
298
-if(!function_exists("sanitizeXSS"))
298
+if (!function_exists("sanitizeXSS"))
299 299
 {
300 300
     function sanitizeXSS($value)
301 301
     {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     }
308 308
 }
309 309
 
310
-if(!function_exists("requestAll")) {
310
+if (!function_exists("requestAll")) {
311 311
     function requestAll() {
312 312
         $all = array_map_r("sanitizeXSS", request()->all());
313 313
         return $all;
@@ -316,22 +316,22 @@  discard block
 block discarded – undo
316 316
 
317 317
 
318 318
 
319
-if(!function_exists('getURLFormat')) {
319
+if (!function_exists('getURLFormat')) {
320 320
     function getURLFormat($name) {
321 321
         $url = request($name);
322
-        if(filter_var($url, FILTER_VALIDATE_URL)) {
322
+        if (filter_var($url, FILTER_VALIDATE_URL)) {
323 323
             return $url;
324
-        }else{
324
+        } else {
325 325
             return request()->url();
326 326
         }
327 327
     }
328 328
 }
329 329
 
330
-if(!function_exists('g')) {
330
+if (!function_exists('g')) {
331 331
     function g($name, $safe = true) {
332
-        if($safe == true) {
332
+        if ($safe == true) {
333 333
             $response = request($name);
334
-            if(is_string($response)) {
334
+            if (is_string($response)) {
335 335
                 $response = sanitizeXSS($response);
336 336
             }elseif (is_array($response)) {
337 337
                 array_walk_recursive($response, function(&$response) {
@@ -340,25 +340,25 @@  discard block
 block discarded – undo
340 340
             }
341 341
 
342 342
             return $response;
343
-        }else{
343
+        } else {
344 344
             return Request::get($name);
345 345
         }
346 346
     }
347 347
 }
348 348
 
349
-if(!function_exists('min_var_export')) {
349
+if (!function_exists('min_var_export')) {
350 350
     function min_var_export($input) {
351
-        if(is_array($input)) {
351
+        if (is_array($input)) {
352 352
             $buffer = [];
353
-            foreach($input as $key => $value)
353
+            foreach ($input as $key => $value)
354 354
                 $buffer[] = var_export($key, true)."=>".min_var_export($value);
355
-            return "[".implode(",",$buffer)."]";
355
+            return "[".implode(",", $buffer)."]";
356 356
         } else
357 357
             return var_export($input, true);
358 358
     }
359 359
 }
360 360
 
361
-if(!function_exists('rrmdir')) {
361
+if (!function_exists('rrmdir')) {
362 362
 	/*
363 363
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
364 364
 	*/
Please login to merge, or discard this patch.
src/helpers/ModuleGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $template = file_get_contents(__DIR__."/../templates/FooBarController.stub");
44 44
 
45 45
         //Replace table
46
-        $template = str_replace("{table}",'"'.$this->table.'"', $template);
46
+        $template = str_replace("{table}", '"'.$this->table.'"', $template);
47 47
 
48 48
         //Replace permalink
49 49
         $template = str_replace("{permalink}", '"'.$this->table.'"', $template);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         //Replace scaffolding
52 52
         $fields = DB::getSchemaBuilder()->getColumnListing($this->table);
53 53
         $scaffold = "";
54
-        foreach($fields as $field) {
54
+        foreach ($fields as $field) {
55 55
             $scaffold .= '$this->addText("'.$field.'");'."\n\t\t";
56 56
         }
57 57
         $template = str_replace("{scaffolding}", $scaffold, $template);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
         //Save to database
68 68
         $module = [];
69
-        $module['name'] = ($this->name)?:ucwords(str_replace("_"," ",$this->table));
69
+        $module['name'] = ($this->name) ?: ucwords(str_replace("_", " ", $this->table));
70 70
         $module['icon'] = $this->icon;
71 71
         $module['table_name'] = $this->table;
72 72
         $module['controller'] = $filename;
Please login to merge, or discard this patch.
src/helpers/SidebarMenus.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     private function assignToModel($menu) {
23 23
         $model = new SidebarModel();
24 24
         $model->setId($menu->id);
25
-        if($menu->type == "url") {
25
+        if ($menu->type == "url") {
26 26
             $model->setUrl($menu->path);
27 27
             $model->setIcon($menu->icon);
28 28
             $model->setName($menu->name);
@@ -47,22 +47,22 @@  discard block
 block discarded – undo
47 47
 
48 48
     private function loadData($parent_id = null) {
49 49
         $menus = DB::table("cb_menus");
50
-        if($parent_id) {
51
-            $menus->where("parent_cb_menus_id",$parent_id);
52
-        }else{
50
+        if ($parent_id) {
51
+            $menus->where("parent_cb_menus_id", $parent_id);
52
+        } else {
53 53
             $menus->whereNull("parent_cb_menus_id");
54 54
         }
55
-        return $menus->orderBy("sort_number","asc")->get();
55
+        return $menus->orderBy("sort_number", "asc")->get();
56 56
     }
57 57
 
58 58
     private function rolePrivilege($cb_roles_id, $cb_menus_id) {
59
-        return cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id]);
59
+        return cb()->find("cb_role_privileges", ['cb_roles_id'=>$cb_roles_id, 'cb_menus_id'=>$cb_menus_id]);
60 60
     }
61 61
 
62
-    private function checkPrivilege($roles_id,$menu) {
63
-        if($roles_id) {
62
+    private function checkPrivilege($roles_id, $menu) {
63
+        if ($roles_id) {
64 64
             $privilege = $this->rolePrivilege($roles_id, $menu->id);
65
-            if(!$privilege->can_browse) {
65
+            if (!$privilege->can_browse) {
66 66
                 return false;
67 67
             }
68 68
         }
@@ -71,26 +71,26 @@  discard block
 block discarded – undo
71 71
     }
72 72
 
73 73
     public function all($withPrivilege = true) {
74
-        $roles_id = ($withPrivilege)?cb()->session()->roleId():null;
74
+        $roles_id = ($withPrivilege) ?cb()->session()->roleId() : null;
75 75
         $menus = $this->loadData();
76 76
         $result = [];
77
-        foreach($menus as $menu) {
77
+        foreach ($menus as $menu) {
78 78
 
79
-            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue;
79
+            if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue;
80 80
 
81 81
             $sidebarModel = $this->assignToModel($menu);
82
-            if($menus2 = $this->loadData($menu->id)) {
82
+            if ($menus2 = $this->loadData($menu->id)) {
83 83
                 $sub1 = [];
84 84
                 foreach ($menus2 as $menu2) {
85 85
 
86
-                    if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue;
86
+                    if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue;
87 87
 
88 88
                     $sidebarModel2 = $this->assignToModel($menu2);
89
-                    if($menus3 = $this->loadData($menu2->id)) {
89
+                    if ($menus3 = $this->loadData($menu2->id)) {
90 90
                         $sub2 = [];
91 91
                         foreach ($menus3 as $menu3) {
92 92
 
93
-                            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue;
93
+                            if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue;
94 94
 
95 95
                             $sidebarModel3 = $this->assignToModel($menu3);
96 96
                             $sub2[] = $sidebarModel3;
Please login to merge, or discard this patch.
src/types/datetime/Hook.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
      */
21 21
     public function indexRender($row, $column)
22 22
     {
23
-        if($column->getFormat()) {
23
+        if ($column->getFormat()) {
24 24
             return date($column->getFormat(), strtotime($row->{$column->getField()}));
25
-        }else{
25
+        } else {
26 26
             return $row->{$column->getField()};
27 27
         }
28 28
     }
Please login to merge, or discard this patch.