Passed
Push — master ( db619f...0a9de2 )
by Ferry
04:28
created
src/helpers/Helper.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -3,64 +3,64 @@  discard block
 block discarded – undo
3 3
 /*
4 4
  * Theme Helper
5 5
  */
6
-if(!function_exists("themeLoginBackground")) {
6
+if (!function_exists("themeLoginBackground")) {
7 7
     function themeLoginBackground() {
8 8
         return "crudbooster::layouts.login_background_css";
9 9
     }
10 10
 }
11
-if(!function_exists("themeFlashMessageAlert")) {
11
+if (!function_exists("themeFlashMessageAlert")) {
12 12
     function themeFlashMessageAlert() {
13 13
         return "crudbooster::layouts.flash_message_alert";
14 14
     }
15 15
 }
16 16
 
17
-if(!function_exists("themeFlashMessage")) {
17
+if (!function_exists("themeFlashMessage")) {
18 18
     function themeFlashMessage() {
19 19
         return "crudbooster::layouts.flash_message";
20 20
     }
21 21
 }
22 22
 
23
-if(!function_exists("themeAlertMessage")) {
23
+if (!function_exists("themeAlertMessage")) {
24 24
     function themeAlertMessage() {
25 25
         return "crudbooster::layouts.alert_message";
26 26
     }
27 27
 }
28 28
 
29
-if(!function_exists("themeLayoutPageTitleAndButton")) {
29
+if (!function_exists("themeLayoutPageTitleAndButton")) {
30 30
     function themeLayoutPageTitleAndButton() {
31 31
         return 'crudbooster::module.index.index_head_buttons';
32 32
     }
33 33
 }
34 34
 
35
-if(!function_exists("themeLayoutHead")) {
35
+if (!function_exists("themeLayoutHead")) {
36 36
     function themeLayoutHead() {
37 37
         return "crudbooster::layouts.head";
38 38
     }
39 39
 }
40
-if(!function_exists("themeTitle")) {
40
+if (!function_exists("themeTitle")) {
41 41
     function themeTitle($page_title) {
42
-        $page_title = isset($page_title)?$page_title:module()->getPageTitle();
43
-        return (isset($page_title))?cb()->getAppName().': '.strip_tags($page_title):"Admin Area";
42
+        $page_title = isset($page_title) ? $page_title : module()->getPageTitle();
43
+        return (isset($page_title)) ?cb()->getAppName().': '.strip_tags($page_title) : "Admin Area";
44 44
     }
45 45
 }
46 46
 
47
-if(!function_exists("getThemePath")) {
47
+if (!function_exists("getThemePath")) {
48 48
     function getThemePath($path = null) {
49
-        return getSetting("theme_path", "crudbooster::themes.adminlte").(($path)?".".$path:null);
49
+        return getSetting("theme_path", "crudbooster::themes.adminlte").(($path) ? ".".$path : null);
50 50
     }
51 51
 }
52 52
 
53 53
 // End Theme Helper
54 54
 
55
-if(!function_exists("isConfigCached")) {
55
+if (!function_exists("isConfigCached")) {
56 56
     function isConfigCached()
57 57
     {
58
-        if(env("APP_NAME")=="" || env("APP_NAME")==null) return true;
58
+        if (env("APP_NAME") == "" || env("APP_NAME") == null) return true;
59 59
         else return false;
60 60
     }
61 61
 }
62 62
 
63
-if(!function_exists("miscellanousSingleton")) {
63
+if (!function_exists("miscellanousSingleton")) {
64 64
     /**
65 65
      * @return \crocodicstudio\crudbooster\helpers\MiscellanousSingleton
66 66
      */
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
     }
70 70
 }
71 71
 
72
-if(!function_exists("makeReferalUrl")) {
72
+if (!function_exists("makeReferalUrl")) {
73 73
     function makeReferalUrl($name = null) {
74 74
         $ref = [];
75 75
         $ref['url'] = request()->fullUrl();
76 76
         $ref['name'] = $name;
77 77
         $md5Hash = md5(serialize($ref));
78 78
 
79
-        if($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) {
79
+        if ($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) {
80 80
             return $exist['id'];
81 81
         }
82 82
 
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
     }
89 89
 }
90 90
 
91
-if(!function_exists("getReferalUrl")) {
91
+if (!function_exists("getReferalUrl")) {
92 92
     function getReferalUrl($key = null) {
93
-        if(verifyReferalUrl()) {
93
+        if (verifyReferalUrl()) {
94 94
             $md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"));
95 95
             $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash);
96
-            if($key) {
96
+            if ($key) {
97 97
                 return @$ref[$key];
98 98
             } else {
99 99
                 return $ref;
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
     }
104 104
 }
105 105
 
106
-if(!function_exists("verifyReferalUrl")) {
106
+if (!function_exists("verifyReferalUrl")) {
107 107
     function verifyReferalUrl()
108 108
     {
109
-        if(request("ref")) {
110
-            if($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) {
109
+        if (request("ref")) {
110
+            if ($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) {
111 111
                 $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash);
112
-                if(filter_var($ref['url'], FILTER_VALIDATE_URL)) {
112
+                if (filter_var($ref['url'], FILTER_VALIDATE_URL)) {
113 113
                     return true;
114 114
                 }
115 115
             }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     }
119 119
 }
120 120
 
121
-if(!function_exists("putHtaccess")) {
121
+if (!function_exists("putHtaccess")) {
122 122
     function putHtaccess($stringToPut)
123 123
     {
124 124
         file_put_contents(base_path(".htaccess"), "\n".$stringToPut, FILE_APPEND);
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
     }
127 127
 }
128 128
 
129
-if(!function_exists("checkHtaccess")) {
129
+if (!function_exists("checkHtaccess")) {
130 130
     function checkHtaccess($stringToCheck)
131 131
     {
132
-        if(file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) {
132
+        if (file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) {
133 133
             $htaccess = file_get_contents(base_path(".htaccess"));
134
-            $htaccess2= file_get_contents(public_path(".htaccess"));
135
-            if(\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) {
134
+            $htaccess2 = file_get_contents(public_path(".htaccess"));
135
+            if (\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) {
136 136
                 return true;
137 137
             }
138 138
         }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     }
142 142
 }
143 143
 
144
-if(!function_exists("setEnvironmentValue")) {
144
+if (!function_exists("setEnvironmentValue")) {
145 145
     function setEnvironmentValue(array $values)
146 146
     {
147 147
         $envFile = app()->environmentFilePath();
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 }
173 173
 
174 174
 
175
-if(!function_exists("cbLang")) {
175
+if (!function_exists("cbLang")) {
176 176
     /**
177 177
      * @param string $key
178 178
      * @param array $replace
@@ -184,17 +184,17 @@  discard block
 block discarded – undo
184 184
     }
185 185
 }
186 186
 
187
-if(!function_exists('rglob')) {
187
+if (!function_exists('rglob')) {
188 188
     function rglob($pattern, $flags = 0) {
189 189
         $files = glob($pattern, $flags);
190
-        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
190
+        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
191 191
             $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags));
192 192
         }
193 193
         return $files;
194 194
     }
195 195
 }
196 196
 
197
-if(!function_exists('convertPHPToMomentFormat')) {
197
+if (!function_exists('convertPHPToMomentFormat')) {
198 198
     function convertPHPToMomentFormat($format)
199 199
     {
200 200
         $replacements = [
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
     }
242 242
 }
243 243
 
244
-if(!function_exists('slug')) {
244
+if (!function_exists('slug')) {
245 245
     function slug($string, $separator = '-') {
246 246
         return \Illuminate\Support\Str::slug($string, $separator);
247 247
     }
248 248
 }
249 249
 
250
-if(!function_exists('columnSingleton')) {
250
+if (!function_exists('columnSingleton')) {
251 251
     /**
252 252
      * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton
253 253
      */
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     }
257 257
 }
258 258
 
259
-if(!function_exists('cbHook'))
259
+if (!function_exists('cbHook'))
260 260
 {
261 261
     /**
262 262
      * @return crocodicstudio\crudbooster\hooks\CBHook
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     }
269 269
 }
270 270
 
271
-if(!function_exists('getTypeHook'))
271
+if (!function_exists('getTypeHook'))
272 272
 {
273 273
     /**
274 274
      * @param string $type
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     }
282 282
 }
283 283
 
284
-if(!function_exists('getPrimaryKey'))
284
+if (!function_exists('getPrimaryKey'))
285 285
 {
286 286
     function getPrimaryKey($table_name)
287 287
     {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     }
290 290
 }
291 291
 
292
-if(!function_exists('cb'))
292
+if (!function_exists('cb'))
293 293
 {
294 294
     function cb()
295 295
     {
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
     }
298 298
 }
299 299
 
300
-if(!function_exists("cbAssetPath")) {
300
+if (!function_exists("cbAssetPath")) {
301 301
     function cbAssetPath($path = null) {
302
-        return "cb_asset".(($path)?"/".$path:null);
302
+        return "cb_asset".(($path) ? "/".$path : null);
303 303
     }
304 304
 }
305
-if(!function_exists('cbAsset')) {
305
+if (!function_exists('cbAsset')) {
306 306
     function cbAsset($path, $secure = null) {
307 307
         return asset(cbAssetPath()."/".$path, $secure);
308 308
     }
309 309
 }
310 310
 
311
-if(!function_exists("cbConfig")) {
311
+if (!function_exists("cbConfig")) {
312 312
     function cbConfig($name, $default = null) {
313 313
         return config("crudbooster.".$name, $default);
314 314
     }
315 315
 }
316 316
 
317
-if(!function_exists("strRandom")) {
317
+if (!function_exists("strRandom")) {
318 318
     function strRandom($length = 5) {
319 319
         return \Illuminate\Support\Str::random($length);
320 320
     }
321 321
 }
322 322
 
323
-if(!function_exists('module')) {
323
+if (!function_exists('module')) {
324 324
     function module()
325 325
     {
326 326
         $module = new \crocodicstudio\crudbooster\helpers\Module();
@@ -328,21 +328,21 @@  discard block
 block discarded – undo
328 328
     }
329 329
 }
330 330
 
331
-if(!function_exists('getAdminLoginURL')) {
331
+if (!function_exists('getAdminLoginURL')) {
332 332
     function getAdminLoginURL()
333 333
     {
334 334
         return cb()->getAdminUrl("login");
335 335
     }
336 336
 }
337 337
 
338
-if(!function_exists('dummyPhoto')) {
338
+if (!function_exists('dummyPhoto')) {
339 339
     function dummyPhoto()
340 340
     {
341 341
         return cbConfig("DUMMY_PHOTO");
342 342
     }
343 343
 }
344 344
 
345
-if(!function_exists('extract_unit')) {	
345
+if (!function_exists('extract_unit')) {	
346 346
 	/*
347 347
 	Credits: Bit Repository
348 348
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 |
368 368
 */
369 369
 
370
-if(!function_exists('putSetting')) {
370
+if (!function_exists('putSetting')) {
371 371
     function putSetting($key, $value)
372 372
     {
373
-        if(file_exists(storage_path('.cbconfig'))) {
373
+        if (file_exists(storage_path('.cbconfig'))) {
374 374
             $settings = file_get_contents(storage_path('.cbconfig'));
375 375
             $settings = decrypt($settings);
376 376
             $settings = unserialize($settings);
377
-        }else{
377
+        } else {
378 378
             $settings = [];
379 379
         }
380 380
 
@@ -388,31 +388,31 @@  discard block
 block discarded – undo
388 388
     }
389 389
 }
390 390
 
391
-if(!function_exists('getSetting')) {
391
+if (!function_exists('getSetting')) {
392 392
     function getSetting($key, $default = null)
393 393
     {
394
-        if($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) {
394
+        if ($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) {
395 395
             return $cache;
396 396
         }
397 397
 
398
-        if(file_exists(storage_path('.cbconfig'))) {
398
+        if (file_exists(storage_path('.cbconfig'))) {
399 399
             $settings = file_get_contents(storage_path('.cbconfig'));
400 400
             $settings = decrypt($settings);
401 401
             $settings = unserialize($settings);
402
-        }else{
402
+        } else {
403 403
             $settings = [];
404 404
         }
405 405
 
406
-        if(isset($settings[$key])) {
406
+        if (isset($settings[$key])) {
407 407
             \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]);
408
-            return $settings[$key]?:$default;
409
-        }else{
408
+            return $settings[$key] ?: $default;
409
+        } else {
410 410
             return $default;
411 411
         }
412 412
     }
413 413
 }
414 414
 
415
-if(!function_exists('timeAgo')) {
415
+if (!function_exists('timeAgo')) {
416 416
     function timeAgo($datetime_to, $datetime_from = null, $full = false)
417 417
     {
418 418
         $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
             }
444 444
         }
445 445
 
446
-        if (! $full) {
446
+        if (!$full) {
447 447
             $string = array_slice($string, 0, 1);
448 448
         }
449 449
 
@@ -451,22 +451,22 @@  discard block
 block discarded – undo
451 451
     }
452 452
 }
453 453
 
454
-if(!function_exists("array_map_r")) {
455
-    function array_map_r( $func, $arr )
454
+if (!function_exists("array_map_r")) {
455
+    function array_map_r($func, $arr)
456 456
     {
457 457
         $newArr = array();
458 458
 
459
-        foreach( $arr as $key => $value )
459
+        foreach ($arr as $key => $value)
460 460
         {
461 461
             $key = $func($key);
462
-            $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) );
462
+            $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value)));
463 463
         }
464 464
 
465 465
         return $newArr;
466 466
     }
467 467
 }
468 468
 
469
-if(!function_exists("sanitizeXSS"))
469
+if (!function_exists("sanitizeXSS"))
470 470
 {
471 471
     function sanitizeXSS($value)
472 472
     {
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     }
479 479
 }
480 480
 
481
-if(!function_exists("requestAll")) {
481
+if (!function_exists("requestAll")) {
482 482
     function requestAll() {
483 483
         $all = array_map_r("sanitizeXSS", request()->all());
484 484
         return $all;
@@ -487,22 +487,22 @@  discard block
 block discarded – undo
487 487
 
488 488
 
489 489
 
490
-if(!function_exists('getURLFormat')) {
490
+if (!function_exists('getURLFormat')) {
491 491
     function getURLFormat($name) {
492 492
         $url = request($name);
493
-        if(filter_var($url, FILTER_VALIDATE_URL)) {
493
+        if (filter_var($url, FILTER_VALIDATE_URL)) {
494 494
             return $url;
495
-        }else{
495
+        } else {
496 496
             return request()->url();
497 497
         }
498 498
     }
499 499
 }
500 500
 
501
-if(!function_exists('g')) {
501
+if (!function_exists('g')) {
502 502
     function g($name, $safe = true) {
503
-        if($safe == true) {
503
+        if ($safe == true) {
504 504
             $response = request($name);
505
-            if(is_string($response)) {
505
+            if (is_string($response)) {
506 506
                 $response = sanitizeXSS($response);
507 507
             }elseif (is_array($response)) {
508 508
                 array_walk_recursive($response, function(&$response) {
@@ -511,25 +511,25 @@  discard block
 block discarded – undo
511 511
             }
512 512
 
513 513
             return $response;
514
-        }else{
514
+        } else {
515 515
             return Request::get($name);
516 516
         }
517 517
     }
518 518
 }
519 519
 
520
-if(!function_exists('min_var_export')) {
520
+if (!function_exists('min_var_export')) {
521 521
     function min_var_export($input) {
522
-        if(is_array($input)) {
522
+        if (is_array($input)) {
523 523
             $buffer = [];
524
-            foreach($input as $key => $value)
524
+            foreach ($input as $key => $value)
525 525
                 $buffer[] = var_export($key, true)."=>".min_var_export($value);
526
-            return "[".implode(",",$buffer)."]";
526
+            return "[".implode(",", $buffer)."]";
527 527
         } else
528 528
             return var_export($input, true);
529 529
     }
530 530
 }
531 531
 
532
-if(!function_exists('rrmdir')) {
532
+if (!function_exists('rrmdir')) {
533 533
 	/*
534 534
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
535 535
 	*/
Please login to merge, or discard this patch.
src/helpers/Plugin.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,26 +15,26 @@  discard block
 block discarded – undo
15 15
 
16 16
     public static function has($key)
17 17
     {
18
-        if(file_exists(app_path("CBPlugins/".$key))) return true;
18
+        if (file_exists(app_path("CBPlugins/".$key))) return true;
19 19
         else return false;
20 20
     }
21 21
 
22 22
     public static function isNeedUpgrade($pluginKey, $versionToCompare)
23 23
     {
24 24
         $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$pluginKey."/plugin.json")), true);
25
-        if($pluginJson) {
26
-            return version_compare($pluginJson['version'], $versionToCompare,"!=");
27
-        }else{
25
+        if ($pluginJson) {
26
+            return version_compare($pluginJson['version'], $versionToCompare, "!=");
27
+        } else {
28 28
             return false;
29 29
         }
30 30
     }
31 31
 
32 32
     public static function registerDefaultRoute($dir)
33 33
     {
34
-        Route::group(['middleware' => ['web',\crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
34
+        Route::group(['middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
35 35
             'prefix'=>"developer/".getSetting('developer_path'),
36
-            'namespace' => 'App\CBPlugins\\'.basename(dirname("./../".$dir)).'\Controllers'], function () use ($dir) {
37
-            cb()->routeController("plugins/".basename(dirname("./../".$dir)),"\App\CBPlugins\\".basename(dirname("./../".$dir))."\Controllers\\".basename(dirname("./../".$dir))."Controller");
36
+            'namespace' => 'App\CBPlugins\\'.basename(dirname("./../".$dir)).'\Controllers'], function() use ($dir) {
37
+            cb()->routeController("plugins/".basename(dirname("./../".$dir)), "\App\CBPlugins\\".basename(dirname("./../".$dir))."\Controllers\\".basename(dirname("./../".$dir))."Controller");
38 38
         });
39 39
     }
40 40
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
         $plugins_from_master = $this->getAll(__DIR__."/../views/themes");
44 44
         $result = [];
45 45
         $plugins = array_merge($plugins_from_master, $plugins_from_user);
46
-        foreach($plugins as $plugin) {
47
-            if($plugin['type'] == "theme") {
46
+        foreach ($plugins as $plugin) {
47
+            if ($plugin['type'] == "theme") {
48 48
                 $result[] = $plugin;
49 49
             }
50 50
         }
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function getAll($path = null)
55 55
     {
56
-        $path = ($path)?:app_path("CBPlugins");
56
+        $path = ($path) ?: app_path("CBPlugins");
57 57
         $plugins = scandir($path);
58 58
 
59 59
         $result = [];
60
-        foreach($plugins as $plugin) {
61
-            if($plugin != "." && $plugin != "..") {
60
+        foreach ($plugins as $plugin) {
61
+            if ($plugin != "." && $plugin != "..") {
62 62
                 $basename = basename($plugin);
63 63
                 $row = json_decode(file_get_contents($path.DIRECTORY_SEPARATOR.$plugin.DIRECTORY_SEPARATOR."plugin.json"), true);
64
-                if($row) {
64
+                if ($row) {
65 65
                     try {
66 66
                         $row['url'] = route($basename."ControllerGetIndex");
67 67
                     } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/routes.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,59 +1,59 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Developer Backend Middleware
4
-Route::group(['middleware' => ['web',\crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
4
+Route::group(['middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
5 5
     'prefix'=>"developer/".getSetting('developer_path'),
6
-    'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
6
+    'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
7 7
     cb()->routeController("modules", "\crocodicstudio\crudbooster\controllers\DeveloperModulesController");
8 8
     cb()->routeController("menus", "\crocodicstudio\crudbooster\controllers\DeveloperMenusController");
9
-    cb()->routeController("roles","\crocodicstudio\crudbooster\controllers\DeveloperRolesController");
10
-    cb()->routeController("users","\crocodicstudio\crudbooster\controllers\DeveloperUsersController");
11
-    cb()->routeController("plugins","\crocodicstudio\crudbooster\controllers\DeveloperPluginStoreController");
12
-    cb()->routeController("mail","\crocodicstudio\crudbooster\controllers\DeveloperMailController");
13
-    cb()->routeController("security","\crocodicstudio\crudbooster\controllers\DeveloperSecurityController");
14
-    cb()->routeController("themes","\crocodicstudio\crudbooster\controllers\DeveloperThemesController");
15
-    cb()->routeController("appearance","\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController");
16
-    cb()->routeController("miscellaneous","\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController");
17
-    cb()->routePost("skip-tutorial","DeveloperDashboardController@postSkipTutorial");
18
-    cb()->routeGet("/","DeveloperDashboardController@getIndex");
9
+    cb()->routeController("roles", "\crocodicstudio\crudbooster\controllers\DeveloperRolesController");
10
+    cb()->routeController("users", "\crocodicstudio\crudbooster\controllers\DeveloperUsersController");
11
+    cb()->routeController("plugins", "\crocodicstudio\crudbooster\controllers\DeveloperPluginStoreController");
12
+    cb()->routeController("mail", "\crocodicstudio\crudbooster\controllers\DeveloperMailController");
13
+    cb()->routeController("security", "\crocodicstudio\crudbooster\controllers\DeveloperSecurityController");
14
+    cb()->routeController("themes", "\crocodicstudio\crudbooster\controllers\DeveloperThemesController");
15
+    cb()->routeController("appearance", "\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController");
16
+    cb()->routeController("miscellaneous", "\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController");
17
+    cb()->routePost("skip-tutorial", "DeveloperDashboardController@postSkipTutorial");
18
+    cb()->routeGet("/", "DeveloperDashboardController@getIndex");
19 19
 });
20 20
 
21 21
 // Developer Auth Middleware
22 22
 Route::group(['middleware' => ['web'],
23 23
     'prefix'=>"developer/".getSetting('developer_path'),
24
-    'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
25
-    cb()->routePost("login","AdminAuthController@postLoginDeveloper");
26
-    cb()->routeGet("login","AdminAuthController@getLoginDeveloper");
27
-    cb()->routeGet("logout","AdminAuthController@getLogoutDeveloper");
24
+    'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
25
+    cb()->routePost("login", "AdminAuthController@postLoginDeveloper");
26
+    cb()->routeGet("login", "AdminAuthController@getLoginDeveloper");
27
+    cb()->routeGet("logout", "AdminAuthController@getLogoutDeveloper");
28 28
 });
29 29
 
30 30
 // Routing without any middleware
31
-Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function () {
32
-    if(getSetting("AUTO_REDIRECT_TO_LOGIN")) {
33
-        cb()->routeGet("/","AdminAuthController@getRedirectToLogin");
31
+Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function() {
32
+    if (getSetting("AUTO_REDIRECT_TO_LOGIN")) {
33
+        cb()->routeGet("/", "AdminAuthController@getRedirectToLogin");
34 34
     }
35 35
 });
36 36
 
37 37
 // Routing without any middleware with admin prefix
38
-Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
38
+Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
39 39
     cb()->routeGet('logout', "AdminAuthController@getLogout");
40 40
 
41
-    if(!getSetting("DISABLE_LOGIN")) {
41
+    if (!getSetting("DISABLE_LOGIN")) {
42 42
         cb()->routePost('login', "AdminAuthController@postLogin");
43 43
         cb()->routeGet('login', "AdminAuthController@getLogin");
44 44
     }
45 45
 
46
-    if(getSetting("enable_forget")) {
47
-        cb()->routePost("forget","AdminAuthController@postForget");
46
+    if (getSetting("enable_forget")) {
47
+        cb()->routePost("forget", "AdminAuthController@postForget");
48 48
     }
49 49
 
50
-    if(getSetting("enable_register")) {
51
-        cb()->routePost("register","AdminAuthController@postRegister");
50
+    if (getSetting("enable_register")) {
51
+        cb()->routePost("register", "AdminAuthController@postRegister");
52 52
     }
53 53
 });
54 54
 
55 55
 // Routing package controllers
56
-cb()->routeGroupBackend(function () {
56
+cb()->routeGroupBackend(function() {
57 57
     cb()->routeController('profile', '\crocodicstudio\crudbooster\controllers\AdminProfileController');
58 58
 });
59 59
 
@@ -62,24 +62,24 @@  discard block
 block discarded – undo
62 62
     'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBBackend::class],
63 63
     'prefix' => cb()->getAdminPath(),
64 64
     'namespace' => 'App\Http\Controllers',
65
-], function () {
65
+], function() {
66 66
 
67 67
     if (Request::is(cb()->getAdminPath())) {
68
-        if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
68
+        if ($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
69 69
             cb()->routeGet("/", $dashboard);
70
-        }else{
70
+        } else {
71 71
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
72 72
         }
73 73
     }
74 74
 
75 75
     $controllers = glob(app_path('Http/Controllers/Admin*Controller.php'));
76 76
 
77
-    foreach($controllers as $controller) {
77
+    foreach ($controllers as $controller) {
78 78
         $controllerName = basename($controller);
79
-        $controllerName = rtrim($controllerName,".php");
79
+        $controllerName = rtrim($controllerName, ".php");
80 80
         $className = '\App\Http\Controllers\\'.$controllerName;
81 81
         $controllerClass = new $className();
82
-        if(method_exists($controllerClass, 'cbInit')) {
82
+        if (method_exists($controllerClass, 'cbInit')) {
83 83
             cb()->routeController($controllerClass->getData('permalink'), $controllerName);
84 84
         }
85 85
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperThemesController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,21 +20,21 @@
 block discarded – undo
20 20
         $themes = (new Plugin())->getAllThemes();
21 21
         $data = [];
22 22
         $data['result'] = $themes;
23
-        return view($this->view.".index",$data);
23
+        return view($this->view.".index", $data);
24 24
     }
25 25
 
26 26
     public function getActiveTheme($theme_path) {
27 27
         $theme_path = base64_decode($theme_path);
28 28
         putSetting("theme_path", $theme_path);
29
-        return cb()->redirectBack("Theme has been activated!","success");
29
+        return cb()->redirectBack("Theme has been activated!", "success");
30 30
     }
31 31
 
32 32
     public function postSaveConfig() {
33 33
 
34
-        foreach(request()->except("_token") as $key=>$val) {
35
-            putSetting( $key,  $val);
34
+        foreach (request()->except("_token") as $key=>$val) {
35
+            putSetting($key, $val);
36 36
         }
37 37
 
38
-        return cb()->redirectBack("Theme config has been saved!","success");
38
+        return cb()->redirectBack("Theme config has been saved!", "success");
39 39
     }
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
src/controllers/AdminProfileController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
     public function getIndex() {
12 12
         $data = [];
13 13
         $data['page_title'] = cbLang("profile");
14
-        return view(getThemePath('profile'),$data);
14
+        return view(getThemePath('profile'), $data);
15 15
     }
16 16
 
17 17
     public function postUpdate() {
18
-        validator(request()->all(),[
18
+        validator(request()->all(), [
19 19
             'name'=>'required|max:255|min:3',
20 20
             'email'=>'required|email',
21 21
             'photo'=>'image',
@@ -26,20 +26,20 @@  discard block
 block discarded – undo
26 26
             $data = [];
27 27
             $data['name'] = request('name');
28 28
             $data['email'] = request('email');
29
-            if(request('password')) {
29
+            if (request('password')) {
30 30
                 $data['password'] = Hash::make(request('password'));
31 31
             }
32
-            if(request()->hasFile('photo')) {
32
+            if (request()->hasFile('photo')) {
33 33
                 $data['photo'] = cb()->uploadFile('photo', true, 200, 200);
34 34
             }
35 35
 
36 36
             DB::table("users")->where("id", auth()->id())->update($data);
37
-        }catch (\Exception $e) {
37
+        } catch (\Exception $e) {
38 38
             Log::error($e);
39
-            return cb()->redirectBack(cbLang("something_went_wrong"),"warning");
39
+            return cb()->redirectBack(cbLang("something_went_wrong"), "warning");
40 40
         }
41 41
 
42
-        return cb()->redirectBack("The profile data has been updated!","success");
42
+        return cb()->redirectBack("The profile data has been updated!", "success");
43 43
     }
44 44
 
45 45
 }
Please login to merge, or discard this patch.