Passed
Push — master ( 7a263d...e0b6af )
by Ferry
05:04
created
src/controllers/AdminProfileController.php 2 patches
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('crudbooster::profile',$data);
14
+        return view('crudbooster::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.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
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 39
             return cb()->redirectBack(cbLang("something_went_wrong"),"warning");
40 40
         }
Please login to merge, or discard this patch.
src/controllers/DeveloperAuthController.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,25 +19,25 @@
 block discarded – undo
19 19
     }
20 20
 
21 21
     public function postLoginDeveloper() {
22
-        try{
22
+        try {
23 23
             cb()->validation([
24 24
                 'username'=>'required',
25 25
                 'password'=>'required'
26 26
             ]);
27 27
 
28
-            if(request('username') == getSetting('developer_username')
28
+            if (request('username') == getSetting('developer_username')
29 29
                 && request('password') == getSetting("developer_password")) {
30 30
 
31 31
                 session(['developer'=>getSetting('developer_username')]);
32 32
 
33 33
                 return redirect(cb()->getDeveloperUrl());
34 34
 
35
-            }else{
36
-                return cb()->redirectBack( cbLang("password_and_username_is_wrong"));
35
+            } else {
36
+                return cb()->redirectBack(cbLang("password_and_username_is_wrong"));
37 37
             }
38 38
 
39
-        }catch (CBValidationException $e) {
40
-            return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
39
+        } catch (CBValidationException $e) {
40
+            return cb()->redirect(cb()->getLoginUrl(), $e->getMessage(), 'warning');
41 41
         }
42 42
     }
43 43
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
 
33 33
                 return redirect(cb()->getDeveloperUrl());
34 34
 
35
-            }else{
35
+            } else{
36 36
                 return cb()->redirectBack( cbLang("password_and_username_is_wrong"));
37 37
             }
38 38
 
39
-        }catch (CBValidationException $e) {
39
+        } catch (CBValidationException $e) {
40 40
             return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
41 41
         }
42 42
     }
Please login to merge, or discard this patch.
src/controllers/AdminAuthController.php 2 patches
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function getLogin()
35 35
     {
36
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
36
+        if(!auth()->guest()) {
37
+            return redirect(cb()->getAdminUrl());
38
+        }
37 39
 
38 40
         cbHook()->hookGetLogin();
39 41
 
@@ -43,7 +45,9 @@  discard block
 block discarded – undo
43 45
     public function postLogin()
44 46
     {
45 47
         try{
46
-            if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
48
+            if($this->isSuspendedLogin()) {
49
+                throw new CBValidationException(cbLang("you_have_been_suspended"));
50
+            }
47 51
 
48 52
             cb()->validation([
49 53
                 'email'=>'required|email',
@@ -58,7 +62,7 @@  discard block
 block discarded – undo
58 62
                 $this->incrementFailedLogin();
59 63
                 return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']);
60 64
             }
61
-        }catch (CBValidationException $e) {
65
+        } catch (CBValidationException $e) {
62 66
             return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
63 67
         }
64 68
     }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,29 +20,29 @@  discard block
 block discarded – undo
20 20
 
21 21
     public function getLogin()
22 22
     {
23
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
23
+        if (!auth()->guest()) return redirect(cb()->getAdminUrl());
24 24
 
25 25
         cbHook()->hookGetLogin();
26 26
 
27 27
         $data = [];
28
-        $data['no1'] = rand(1,10);
29
-        $data['no2'] = rand(1,10);
30
-        Session::put("captcha_result", $data['no1']+$data['no2']);
28
+        $data['no1'] = rand(1, 10);
29
+        $data['no2'] = rand(1, 10);
30
+        Session::put("captcha_result", $data['no1'] + $data['no2']);
31 31
 
32
-        return view( str_replace(".blade.php", "", getSetting('login_page_view','crudbooster::login')), $data );
32
+        return view(str_replace(".blade.php", "", getSetting('login_page_view', 'crudbooster::login')), $data);
33 33
     }
34 34
 
35 35
     public function postLogin()
36 36
     {
37
-        try{
38
-            if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
37
+        try {
38
+            if ($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
39 39
 
40 40
             cb()->validation([
41 41
                 'email'=>'required|email',
42 42
                 'password'=>'required'
43 43
             ]);
44 44
 
45
-            $credential = request()->only(['email','password']);
45
+            $credential = request()->only(['email', 'password']);
46 46
             if (auth()->attempt($credential)) {
47 47
 
48 48
                 // When login user success, clear suspend attempt
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
                 return redirect(cb()->getAdminUrl());
54 54
             } else {
55 55
                 $this->incrementFailedLogin();
56
-                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']);
56
+                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'), 'message_type'=>'warning']);
57 57
             }
58
-        }catch (CBValidationException $e) {
59
-            return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
58
+        } catch (CBValidationException $e) {
59
+            return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning');
60 60
         }
61 61
     }
62 62
 
Please login to merge, or discard this patch.
src/controllers/DeveloperPluginStoreController.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function getIndex() {
30 30
 
31
-        if(request("refresh")) {
32
-            $this->fetchPluginData(false );
33
-            return cb()->redirectBack("Plugin list has been refreshed!","success");
31
+        if (request("refresh")) {
32
+            $this->fetchPluginData(false);
33
+            return cb()->redirectBack("Plugin list has been refreshed!", "success");
34 34
         }
35 35
 
36 36
         $data = [];
37 37
         $data['result'] = $this->fetchPluginData();
38
-        return view($this->view.'.index',$data);
38
+        return view($this->view.'.index', $data);
39 39
     }
40 40
 
41 41
     public function postLoginAccount() {
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
         ]);
51 51
         $response = $curl->send();
52 52
 
53
-        if($respArray = json_decode($response, true)) {
54
-            if($respArray['status'] && isset($respArray['token'])) {
53
+        if ($respArray = json_decode($response, true)) {
54
+            if ($respArray['status'] && isset($respArray['token'])) {
55 55
                 session(['account_token'=>$respArray['token']]);
56 56
             }
57
-            return response()->make($response,200,["Content-Type"=>"application/json"]);
57
+            return response()->make($response, 200, ["Content-Type"=>"application/json"]);
58 58
         } else {
59
-            return response()->json(['status'=>false,'message'=>'failed']);
59
+            return response()->json(['status'=>false, 'message'=>'failed']);
60 60
         }
61 61
     }
62 62
 
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
         ]);
74 74
         $response = $curl->send();
75 75
 
76
-        if($respArray = json_decode($response, true)) {
77
-            if($respArray['status']) {
76
+        if ($respArray = json_decode($response, true)) {
77
+            if ($respArray['status']) {
78 78
                 $form = base64_decode($respArray['payment']);
79
-                return response()->json(['status'=>true,'form'=>$form]);
79
+                return response()->json(['status'=>true, 'form'=>$form]);
80 80
             } else {
81 81
                 return response()->json($respArray);
82 82
             }
83 83
         } else {
84
-            return response()->json(['status'=>false,'message'=>'failed','raw'=>$response]);
84
+            return response()->json(['status'=>false, 'message'=>'failed', 'raw'=>$response]);
85 85
         }
86 86
     }
87 87
 
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $pluginData = $this->fetchPluginData();
91 91
 
92
-        if(isset($pluginData[$key])) {
93
-            if(file_exists(app_path("CBPlugins/".$key))) {
92
+        if (isset($pluginData[$key])) {
93
+            if (file_exists(app_path("CBPlugins/".$key))) {
94 94
                 rrmdir(app_path("CBPlugins/".$key));
95 95
                 return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']);
96
-            }else{
97
-                return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']);
96
+            } else {
97
+                return response()->json(['status'=>false, 'message'=>'Failed to uninstall, plugin is not found']);
98 98
             }
99
-        }else {
100
-            return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']);
99
+        } else {
100
+            return response()->json(['status'=>false, 'message'=>'Failed to uninstall, plugin key is not found']);
101 101
         }
102 102
     }
103 103
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     {
106 106
         $pluginData = $this->fetchPluginData();
107 107
 
108
-        if(isset($pluginData[$key])) {
108
+        if (isset($pluginData[$key])) {
109 109
             $plugin = $pluginData[$key];
110 110
 
111 111
             // Create temp file of zip plugin
@@ -123,22 +123,22 @@  discard block
 block discarded – undo
123 123
                 fclose($temp);
124 124
 
125 125
                 // Rename
126
-                if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
126
+                if (file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
127 127
                 rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key));
128 128
 
129
-                return response()->json(['status'=>true,'message'=>'Install / update plugin has been succesfull!']);
129
+                return response()->json(['status'=>true, 'message'=>'Install / update plugin has been succesfull!']);
130 130
 
131 131
             } else {
132
-                return response()->json(['status'=>false,'message'=>"Failed to install/update, can't open the plugin archive"]);
132
+                return response()->json(['status'=>false, 'message'=>"Failed to install/update, can't open the plugin archive"]);
133 133
             }
134
-        }else{
135
-            return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']);
134
+        } else {
135
+            return response()->json(['status'=>false, 'message'=>'Failed to install/update, plugin key is not found']);
136 136
         }
137 137
     }
138 138
 
139 139
     private function fetchPluginData($cache = true)
140 140
     {
141
-        if($cache === true && $data = Cache::get("plugin_store_data")) {
141
+        if ($cache === true && $data = Cache::get("plugin_store_data")) {
142 142
             return $data;
143 143
         }
144 144
 
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
             $context = stream_context_create($opts);
156 156
             $data = file_get_contents(base64_decode("aHR0cDovL2NydWRib29zdGVyLmNvbS9hcGkvcGx1Z2luP2FjY2Vzc190b2tlbj1iVmMvWm5wWU5TWnJNVlpZT0hFNVUydHFjU1U9"), false, $context);
157 157
 
158
-            if($data) {
158
+            if ($data) {
159 159
                 $data = json_decode($data, true);
160
-                if($data['status']==true) {
160
+                if ($data['status'] == true) {
161 161
 
162
-                    foreach($data['data'] as $item) {
162
+                    foreach ($data['data'] as $item) {
163 163
                         $key = $item['key'];
164
-                        $result[ $key ] = $item;
164
+                        $result[$key] = $item;
165 165
                     }
166 166
 
167 167
                     $result = collect($result)->sortBy("name")->all();
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
             if(file_exists(app_path("CBPlugins/".$key))) {
94 94
                 rrmdir(app_path("CBPlugins/".$key));
95 95
                 return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']);
96
-            }else{
96
+            } else{
97 97
                 return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']);
98 98
             }
99
-        }else {
99
+        } else {
100 100
             return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']);
101 101
         }
102 102
     }
@@ -123,7 +123,9 @@  discard block
 block discarded – undo
123 123
                 fclose($temp);
124 124
 
125 125
                 // Rename
126
-                if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
126
+                if(file_exists(app_path("CBPlugins/".$key))) {
127
+                    rrmdir(app_path("CBPlugins/".$key));
128
+                }
127 129
                 rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key));
128 130
 
129 131
                 return response()->json(['status'=>true,'message'=>'Install / update plugin has been succesfull!']);
@@ -131,7 +133,7 @@  discard block
 block discarded – undo
131 133
             } else {
132 134
                 return response()->json(['status'=>false,'message'=>"Failed to install/update, can't open the plugin archive"]);
133 135
             }
134
-        }else{
136
+        } else{
135 137
             return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']);
136 138
         }
137 139
     }
Please login to merge, or discard this patch.
src/helpers/Helper.php 3 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -220,20 +220,20 @@  discard block
 block discarded – undo
220 220
 }
221 221
 
222 222
 if(!function_exists('extract_unit')) {	
223
-	/*
223
+    /*
224 224
 	Credits: Bit Repository
225 225
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
226 226
 	*/
227
-	function extract_unit($string, $start, $end)
228
-	{
229
-	$pos = stripos($string, $start);
230
-	$str = substr($string, $pos);
231
-	$str_two = substr($str, strlen($start));
232
-	$second_pos = stripos($str_two, $end);
233
-	$str_three = substr($str_two, 0, $second_pos);
234
-	$unit = trim($str_three); // remove whitespaces
235
-	return $unit;
236
-	}
227
+    function extract_unit($string, $start, $end)
228
+    {
229
+    $pos = stripos($string, $start);
230
+    $str = substr($string, $pos);
231
+    $str_two = substr($str, strlen($start));
232
+    $second_pos = stripos($str_two, $end);
233
+    $str_three = substr($str_two, 0, $second_pos);
234
+    $unit = trim($str_three); // remove whitespaces
235
+    return $unit;
236
+    }
237 237
 }
238 238
 
239 239
 /* 
@@ -407,22 +407,22 @@  discard block
 block discarded – undo
407 407
 }
408 408
 
409 409
 if(!function_exists('rrmdir')) {
410
-	/*
410
+    /*
411 411
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
412 412
 	*/
413
-	function rrmdir($dir) { 
414
-	   if (is_dir($dir)) { 
415
-	     $objects = scandir($dir); 
416
-	     foreach ($objects as $object) { 
417
-	       if ($object != "." && $object != "..") { 
418
-	         if (is_dir($dir."/".$object))
419
-	           rrmdir($dir."/".$object);
420
-	         else
421
-	           unlink($dir."/".$object); 
422
-	       } 
423
-	     }
424
-	     rmdir($dir); 
425
-	   } 
426
-	 }
413
+    function rrmdir($dir) { 
414
+        if (is_dir($dir)) { 
415
+            $objects = scandir($dir); 
416
+            foreach ($objects as $object) { 
417
+            if ($object != "." && $object != "..") { 
418
+                if (is_dir($dir."/".$object))
419
+                rrmdir($dir."/".$object);
420
+                else
421
+                unlink($dir."/".$object); 
422
+            } 
423
+            }
424
+            rmdir($dir); 
425
+        } 
426
+        }
427 427
 }
428 428
 
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists("putHtaccess")) {
3
+if (!function_exists("putHtaccess")) {
4 4
     function putHtaccess($stringToPut)
5 5
     {
6 6
         file_put_contents(base_path(".htaccess"), "\n".$stringToPut, FILE_APPEND);
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
     }
9 9
 }
10 10
 
11
-if(!function_exists("checkHtaccess")) {
11
+if (!function_exists("checkHtaccess")) {
12 12
     function checkHtaccess($stringToCheck)
13 13
     {
14
-        if(file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) {
14
+        if (file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) {
15 15
             $htaccess = file_get_contents(base_path(".htaccess"));
16
-            $htaccess2= file_get_contents(public_path(".htaccess"));
17
-            if(\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) {
16
+            $htaccess2 = file_get_contents(public_path(".htaccess"));
17
+            if (\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) {
18 18
                 return true;
19 19
             }
20 20
         }
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     }
24 24
 }
25 25
 
26
-if(!function_exists("setEnvironmentValue")) {
26
+if (!function_exists("setEnvironmentValue")) {
27 27
     function setEnvironmentValue(array $values)
28 28
     {
29 29
         $envFile = app()->environmentFilePath();
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 }
55 55
 
56 56
 
57
-if(!function_exists("cbLang")) {
57
+if (!function_exists("cbLang")) {
58 58
     /**
59 59
      * @param string $key
60 60
      * @param array $replace
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
     }
67 67
 }
68 68
 
69
-if(!function_exists('rglob')) {
69
+if (!function_exists('rglob')) {
70 70
     function rglob($pattern, $flags = 0) {
71 71
         $files = glob($pattern, $flags);
72
-        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
72
+        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
73 73
             $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags));
74 74
         }
75 75
         return $files;
76 76
     }
77 77
 }
78 78
 
79
-if(!function_exists('convertPHPToMomentFormat')) {
79
+if (!function_exists('convertPHPToMomentFormat')) {
80 80
     function convertPHPToMomentFormat($format)
81 81
     {
82 82
         $replacements = [
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
     }
124 124
 }
125 125
 
126
-if(!function_exists('slug')) {
126
+if (!function_exists('slug')) {
127 127
     function slug($string, $separator = '-') {
128 128
         return \Illuminate\Support\Str::slug($string, $separator);
129 129
     }
130 130
 }
131 131
 
132
-if(!function_exists('columnSingleton')) {
132
+if (!function_exists('columnSingleton')) {
133 133
     /**
134 134
      * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton
135 135
      */
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     }
139 139
 }
140 140
 
141
-if(!function_exists('cbHook'))
141
+if (!function_exists('cbHook'))
142 142
 {
143 143
     /**
144 144
      * @return crocodicstudio\crudbooster\hooks\CBHook
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     }
151 151
 }
152 152
 
153
-if(!function_exists('getTypeHook'))
153
+if (!function_exists('getTypeHook'))
154 154
 {
155 155
     /**
156 156
      * @param string $type
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     }
164 164
 }
165 165
 
166
-if(!function_exists('getPrimaryKey'))
166
+if (!function_exists('getPrimaryKey'))
167 167
 {
168 168
     function getPrimaryKey($table_name)
169 169
     {
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     }
172 172
 }
173 173
 
174
-if(!function_exists('cb'))
174
+if (!function_exists('cb'))
175 175
 {
176 176
     function cb()
177 177
     {
@@ -179,25 +179,25 @@  discard block
 block discarded – undo
179 179
     }
180 180
 }
181 181
 
182
-if(!function_exists('cbAsset')) {
182
+if (!function_exists('cbAsset')) {
183 183
     function cbAsset($path, $secure = null) {
184 184
         return asset("cb_asset/".$path, $secure);
185 185
     }
186 186
 }
187 187
 
188
-if(!function_exists("cbConfig")) {
188
+if (!function_exists("cbConfig")) {
189 189
     function cbConfig($name, $default = null) {
190 190
         return config("crudbooster.".$name, $default);
191 191
     }
192 192
 }
193 193
 
194
-if(!function_exists("strRandom")) {
194
+if (!function_exists("strRandom")) {
195 195
     function strRandom($length = 5) {
196 196
         return \Illuminate\Support\Str::random($length);
197 197
     }
198 198
 }
199 199
 
200
-if(!function_exists('module')) {
200
+if (!function_exists('module')) {
201 201
     function module()
202 202
     {
203 203
         $module = new \crocodicstudio\crudbooster\helpers\Module();
@@ -205,21 +205,21 @@  discard block
 block discarded – undo
205 205
     }
206 206
 }
207 207
 
208
-if(!function_exists('getAdminLoginURL')) {
208
+if (!function_exists('getAdminLoginURL')) {
209 209
     function getAdminLoginURL()
210 210
     {
211 211
         return cb()->getAdminUrl("login");
212 212
     }
213 213
 }
214 214
 
215
-if(!function_exists('dummyPhoto')) {
215
+if (!function_exists('dummyPhoto')) {
216 216
     function dummyPhoto()
217 217
     {
218 218
         return cbConfig("DUMMY_PHOTO");
219 219
     }
220 220
 }
221 221
 
222
-if(!function_exists('extract_unit')) {	
222
+if (!function_exists('extract_unit')) {	
223 223
 	/*
224 224
 	Credits: Bit Repository
225 225
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 |
245 245
 */
246 246
 
247
-if(!function_exists('putSetting')) {
247
+if (!function_exists('putSetting')) {
248 248
     function putSetting($key, $value)
249 249
     {
250
-        if(file_exists(storage_path('.cbconfig'))) {
250
+        if (file_exists(storage_path('.cbconfig'))) {
251 251
             $settings = file_get_contents(storage_path('.cbconfig'));
252 252
             $settings = decrypt($settings);
253 253
             $settings = unserialize($settings);
254
-        }else{
254
+        } else {
255 255
             $settings = [];
256 256
         }
257 257
 
@@ -265,31 +265,31 @@  discard block
 block discarded – undo
265 265
     }
266 266
 }
267 267
 
268
-if(!function_exists('getSetting')) {
268
+if (!function_exists('getSetting')) {
269 269
     function getSetting($key, $default = null)
270 270
     {
271
-        if($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) {
271
+        if ($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) {
272 272
             return $cache;
273 273
         }
274 274
 
275
-        if(file_exists(storage_path('.cbconfig'))) {
275
+        if (file_exists(storage_path('.cbconfig'))) {
276 276
             $settings = file_get_contents(storage_path('.cbconfig'));
277 277
             $settings = decrypt($settings);
278 278
             $settings = unserialize($settings);
279
-        }else{
279
+        } else {
280 280
             $settings = [];
281 281
         }
282 282
 
283
-        if(isset($settings[$key])) {
283
+        if (isset($settings[$key])) {
284 284
             \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]);
285
-            return $settings[$key]?:$default;
286
-        }else{
285
+            return $settings[$key] ?: $default;
286
+        } else {
287 287
             return $default;
288 288
         }
289 289
     }
290 290
 }
291 291
 
292
-if(!function_exists('timeAgo')) {
292
+if (!function_exists('timeAgo')) {
293 293
     function timeAgo($datetime_to, $datetime_from = null, $full = false)
294 294
     {
295 295
         $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
             }
321 321
         }
322 322
 
323
-        if (! $full) {
323
+        if (!$full) {
324 324
             $string = array_slice($string, 0, 1);
325 325
         }
326 326
 
@@ -328,22 +328,22 @@  discard block
 block discarded – undo
328 328
     }
329 329
 }
330 330
 
331
-if(!function_exists("array_map_r")) {
332
-    function array_map_r( $func, $arr )
331
+if (!function_exists("array_map_r")) {
332
+    function array_map_r($func, $arr)
333 333
     {
334 334
         $newArr = array();
335 335
 
336
-        foreach( $arr as $key => $value )
336
+        foreach ($arr as $key => $value)
337 337
         {
338 338
             $key = $func($key);
339
-            $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) );
339
+            $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value)));
340 340
         }
341 341
 
342 342
         return $newArr;
343 343
     }
344 344
 }
345 345
 
346
-if(!function_exists("sanitizeXSS"))
346
+if (!function_exists("sanitizeXSS"))
347 347
 {
348 348
     function sanitizeXSS($value)
349 349
     {
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     }
356 356
 }
357 357
 
358
-if(!function_exists("requestAll")) {
358
+if (!function_exists("requestAll")) {
359 359
     function requestAll() {
360 360
         $all = array_map_r("sanitizeXSS", request()->all());
361 361
         return $all;
@@ -364,22 +364,22 @@  discard block
 block discarded – undo
364 364
 
365 365
 
366 366
 
367
-if(!function_exists('getURLFormat')) {
367
+if (!function_exists('getURLFormat')) {
368 368
     function getURLFormat($name) {
369 369
         $url = request($name);
370
-        if(filter_var($url, FILTER_VALIDATE_URL)) {
370
+        if (filter_var($url, FILTER_VALIDATE_URL)) {
371 371
             return $url;
372
-        }else{
372
+        } else {
373 373
             return request()->url();
374 374
         }
375 375
     }
376 376
 }
377 377
 
378
-if(!function_exists('g')) {
378
+if (!function_exists('g')) {
379 379
     function g($name, $safe = true) {
380
-        if($safe == true) {
380
+        if ($safe == true) {
381 381
             $response = request($name);
382
-            if(is_string($response)) {
382
+            if (is_string($response)) {
383 383
                 $response = sanitizeXSS($response);
384 384
             }elseif (is_array($response)) {
385 385
                 array_walk_recursive($response, function(&$response) {
@@ -388,25 +388,25 @@  discard block
 block discarded – undo
388 388
             }
389 389
 
390 390
             return $response;
391
-        }else{
391
+        } else {
392 392
             return Request::get($name);
393 393
         }
394 394
     }
395 395
 }
396 396
 
397
-if(!function_exists('min_var_export')) {
397
+if (!function_exists('min_var_export')) {
398 398
     function min_var_export($input) {
399
-        if(is_array($input)) {
399
+        if (is_array($input)) {
400 400
             $buffer = [];
401
-            foreach($input as $key => $value)
401
+            foreach ($input as $key => $value)
402 402
                 $buffer[] = var_export($key, true)."=>".min_var_export($value);
403
-            return "[".implode(",",$buffer)."]";
403
+            return "[".implode(",", $buffer)."]";
404 404
         } else
405 405
             return var_export($input, true);
406 406
     }
407 407
 }
408 408
 
409
-if(!function_exists('rrmdir')) {
409
+if (!function_exists('rrmdir')) {
410 410
 	/*
411 411
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
412 412
 	*/
Please login to merge, or discard this patch.
Braces   +20 added lines, -15 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@  discard block
 block discarded – undo
48 48
         }
49 49
 
50 50
         $str = substr($str, 0, -1);
51
-        if (!file_put_contents($envFile, $str)) return false;
51
+        if (!file_put_contents($envFile, $str)) {
52
+            return false;
53
+        }
52 54
         return true;
53 55
     }
54 56
 }
@@ -251,7 +253,7 @@  discard block
 block discarded – undo
251 253
             $settings = file_get_contents(storage_path('.cbconfig'));
252 254
             $settings = decrypt($settings);
253 255
             $settings = unserialize($settings);
254
-        }else{
256
+        } else{
255 257
             $settings = [];
256 258
         }
257 259
 
@@ -276,14 +278,14 @@  discard block
 block discarded – undo
276 278
             $settings = file_get_contents(storage_path('.cbconfig'));
277 279
             $settings = decrypt($settings);
278 280
             $settings = unserialize($settings);
279
-        }else{
281
+        } else{
280 282
             $settings = [];
281 283
         }
282 284
 
283 285
         if(isset($settings[$key])) {
284 286
             \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]);
285 287
             return $settings[$key]?:$default;
286
-        }else{
288
+        } else{
287 289
             return $default;
288 290
         }
289 291
     }
@@ -369,7 +371,7 @@  discard block
 block discarded – undo
369 371
         $url = request($name);
370 372
         if(filter_var($url, FILTER_VALIDATE_URL)) {
371 373
             return $url;
372
-        }else{
374
+        } else{
373 375
             return request()->url();
374 376
         }
375 377
     }
@@ -381,14 +383,14 @@  discard block
 block discarded – undo
381 383
             $response = request($name);
382 384
             if(is_string($response)) {
383 385
                 $response = sanitizeXSS($response);
384
-            }elseif (is_array($response)) {
386
+            } elseif (is_array($response)) {
385 387
                 array_walk_recursive($response, function(&$response) {
386 388
                     $response = sanitizeXSS($response);
387 389
                 });
388 390
             }
389 391
 
390 392
             return $response;
391
-        }else{
393
+        } else{
392 394
             return Request::get($name);
393 395
         }
394 396
     }
@@ -398,11 +400,13 @@  discard block
 block discarded – undo
398 400
     function min_var_export($input) {
399 401
         if(is_array($input)) {
400 402
             $buffer = [];
401
-            foreach($input as $key => $value)
402
-                $buffer[] = var_export($key, true)."=>".min_var_export($value);
403
+            foreach($input as $key => $value) {
404
+                            $buffer[] = var_export($key, true)."=>".min_var_export($value);
405
+            }
403 406
             return "[".implode(",",$buffer)."]";
404
-        } else
405
-            return var_export($input, true);
407
+        } else {
408
+                    return var_export($input, true);
409
+        }
406 410
     }
407 411
 }
408 412
 
@@ -415,10 +419,11 @@  discard block
 block discarded – undo
415 419
 	     $objects = scandir($dir); 
416 420
 	     foreach ($objects as $object) { 
417 421
 	       if ($object != "." && $object != "..") { 
418
-	         if (is_dir($dir."/".$object))
419
-	           rrmdir($dir."/".$object);
420
-	         else
421
-	           unlink($dir."/".$object); 
422
+	         if (is_dir($dir."/".$object)) {
423
+	         	           rrmdir($dir."/".$object);
424
+	         } else {
425
+	         	           unlink($dir."/".$object);
426
+	         }
422 427
 	       } 
423 428
 	     }
424 429
 	     rmdir($dir); 
Please login to merge, or discard this patch.
src/helpers/CurlHelper.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function headers(array $headers) {
27 27
         $newHeaders = [];
28
-        foreach($headers as $key=>$val) {
28
+        foreach ($headers as $key=>$val) {
29 29
             $newHeaders[] = $key.": ".$val;
30 30
         }
31 31
         $this->headers = $newHeaders;
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
         $err = curl_error($ch);
48 48
         curl_close($ch);
49 49
 
50
-        if($err) {
50
+        if ($err) {
51 51
             return $err;
52
-        }else {
52
+        } else {
53 53
             return $response;
54 54
         }
55 55
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 
50 50
         if($err) {
51 51
             return $err;
52
-        }else {
52
+        } else {
53 53
             return $response;
54 54
         }
55 55
     }
Please login to merge, or discard this patch.
src/commands/Install.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         if ($this->confirm('Do you have setting the database configuration at .env ?')) {
41 41
 
42
-            if (! file_exists(public_path('vendor')) ) {
42
+            if (!file_exists(public_path('vendor'))) {
43 43
                 mkdir(public_path('vendor'));
44 44
             }
45 45
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             /*
53 53
              * Create CBPlugins
54 54
              */
55
-            if(!file_exists(app_path("CBPlugins"))) {
55
+            if (!file_exists(app_path("CBPlugins"))) {
56 56
                 mkdir(app_path("CBPlugins"));
57 57
             }
58 58
 
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
              * We need it to change default laravel local filesystem from storage to public
62 62
              * We won't use symlink because of a security issue in many server
63 63
              */
64
-            if(!file_exists(public_path("storage"))) {
64
+            if (!file_exists(public_path("storage"))) {
65 65
                 $this->info("Create storage directory on /public");
66 66
                 mkdir(public_path("storage"));
67
-                file_put_contents(public_path("storage/.gitignore"),"!.gitignore");
68
-                file_put_contents(public_path("storage/index.html"),"&nbsp;");
67
+                file_put_contents(public_path("storage/.gitignore"), "!.gitignore");
68
+                file_put_contents(public_path("storage/index.html"), "&nbsp;");
69 69
             }
70 70
 
71 71
             /*
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
              * Disable php execution on /vendor/*
75 75
              */
76 76
             $this->info("Tweak some security for your laravel");
77
-            file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND);
78
-            file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND);
77
+            file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND);
78
+            file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND);
79 79
 
80 80
 
81 81
             $this->info('Dumping the autoloaded files and reloading all new files...');
Please login to merge, or discard this patch.
src/routes.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
     if (Request::is(cb()->getAdminPath())) {
59 59
         if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
60 60
             cb()->routeGet("/", $dashboard);
61
-        }else{
61
+        } else{
62 62
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
63 63
         }
64 64
     }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,58 +1,58 @@  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("appearance","\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController");
15
-    cb()->routeController("miscellaneous","\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController");
16
-    cb()->routePost("skip-tutorial","DeveloperDashboardController@postSkipTutorial");
17
-    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("appearance", "\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController");
15
+    cb()->routeController("miscellaneous", "\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController");
16
+    cb()->routePost("skip-tutorial", "DeveloperDashboardController@postSkipTutorial");
17
+    cb()->routeGet("/", "DeveloperDashboardController@getIndex");
18 18
 });
19 19
 
20 20
 // Developer Auth Middleware
21 21
 Route::group(['middleware' => ['web'],
22 22
     'prefix'=>"developer/".getSetting('developer_path'),
23
-    'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
24
-    cb()->routePost("login","AdminAuthController@postLoginDeveloper");
25
-    cb()->routeGet("login","AdminAuthController@getLoginDeveloper");
26
-    cb()->routeGet("logout","AdminAuthController@getLogoutDeveloper");
23
+    'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
24
+    cb()->routePost("login", "AdminAuthController@postLoginDeveloper");
25
+    cb()->routeGet("login", "AdminAuthController@getLoginDeveloper");
26
+    cb()->routeGet("logout", "AdminAuthController@getLogoutDeveloper");
27 27
 });
28 28
 
29 29
 // Routing without any middleware
30
-Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function () {
31
-    if(getSetting("AUTO_REDIRECT_TO_LOGIN")) {
32
-        cb()->routeGet("/","AdminAuthController@getRedirectToLogin");
30
+Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function() {
31
+    if (getSetting("AUTO_REDIRECT_TO_LOGIN")) {
32
+        cb()->routeGet("/", "AdminAuthController@getRedirectToLogin");
33 33
     }
34 34
 });
35 35
 
36 36
 // Routing without any middleware with admin prefix
37
-Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
37
+Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
38 38
     cb()->routeGet('logout', "AdminAuthController@getLogout");
39 39
 
40
-    if(!getSetting("DISABLE_LOGIN")) {
40
+    if (!getSetting("DISABLE_LOGIN")) {
41 41
         cb()->routePost('login', "AdminAuthController@postLogin");
42 42
         cb()->routeGet('login', "AdminAuthController@getLogin");
43 43
     }
44 44
 
45
-    if(getSetting("enable_forget")) {
46
-        cb()->routePost("forget","AdminAuthController@postForget");
45
+    if (getSetting("enable_forget")) {
46
+        cb()->routePost("forget", "AdminAuthController@postForget");
47 47
     }
48 48
 
49
-    if(getSetting("enable_register")) {
50
-        cb()->routePost("register","AdminAuthController@postRegister");
49
+    if (getSetting("enable_register")) {
50
+        cb()->routePost("register", "AdminAuthController@postRegister");
51 51
     }
52 52
 });
53 53
 
54 54
 // Routing package controllers
55
-cb()->routeGroupBackend(function () {
55
+cb()->routeGroupBackend(function() {
56 56
     cb()->routeController('profile', '\crocodicstudio\crudbooster\controllers\AdminProfileController');
57 57
 });
58 58
 
@@ -61,24 +61,24 @@  discard block
 block discarded – undo
61 61
     'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBBackend::class],
62 62
     'prefix' => cb()->getAdminPath(),
63 63
     'namespace' => 'App\Http\Controllers',
64
-], function () {
64
+], function() {
65 65
 
66 66
     if (Request::is(cb()->getAdminPath())) {
67
-        if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
67
+        if ($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
68 68
             cb()->routeGet("/", $dashboard);
69
-        }else{
69
+        } else {
70 70
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
71 71
         }
72 72
     }
73 73
 
74 74
     $controllers = glob(app_path('Http/Controllers/Admin*Controller.php'));
75 75
 
76
-    foreach($controllers as $controller) {
76
+    foreach ($controllers as $controller) {
77 77
         $controllerName = basename($controller);
78
-        $controllerName = rtrim($controllerName,".php");
78
+        $controllerName = rtrim($controllerName, ".php");
79 79
         $className = '\App\Http\Controllers\\'.$controllerName;
80 80
         $controllerClass = new $className();
81
-        if(method_exists($controllerClass, 'cbInit')) {
81
+        if (method_exists($controllerClass, 'cbInit')) {
82 82
             cb()->routeController($controllerClass->getData('permalink'), $controllerName);
83 83
         }
84 84
     }
Please login to merge, or discard this patch.
src/helpers/CB.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     }
25 25
 
26 26
     public function getRoleByName($roleName) {
27
-        return $this->find("cb_roles",['name'=>$roleName]);
27
+        return $this->find("cb_roles", ['name'=>$roleName]);
28 28
     }
29 29
 
30 30
     public function fcm() {
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     }
41 41
 
42 42
     public function getDeveloperUrl($path = null) {
43
-        $path = ($path)?"/".trim($path,"/"):null;
43
+        $path = ($path) ? "/".trim($path, "/") : null;
44 44
         return url("developer/".getSetting("developer_path")).$path;
45 45
     }
46 46
 
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
     }
58 58
 
59 59
     public function getAdminPath() {
60
-        return getSetting("ADMIN_PATH","admin");
60
+        return getSetting("ADMIN_PATH", "admin");
61 61
     }
62 62
 
63 63
     public function getAdminUrl($path = null) {
64
-        $path = ($path)?"/".trim($path,"/"):null;
64
+        $path = ($path) ? "/".trim($path, "/") : null;
65 65
         return url($this->getAdminPath()).$path;
66 66
     }
67 67
 
68 68
     public function getAppName() {
69
-        return getSetting("APP_NAME", env("APP_NAME","CRUDBOOSTER"));
69
+        return getSetting("APP_NAME", env("APP_NAME", "CRUDBOOSTER"));
70 70
     }
71 71
 
72 72
     /**
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
      */
81 81
     private function uploadFileProcess($filename, $extension, $file, $encrypt = true, $resize_width = null, $resize_height = null)
82 82
     {
83
-        if(in_array($extension,cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
83
+        if (in_array($extension, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
84 84
             $file_path = cbConfig("UPLOAD_PATH_FORMAT");
85
-            $file_path = str_replace("{Y}",date('Y'), $file_path);
85
+            $file_path = str_replace("{Y}", date('Y'), $file_path);
86 86
             $file_path = str_replace("{m}", date('m'), $file_path);
87 87
             $file_path = str_replace("{d}", date("d"), $file_path);
88 88
 
89 89
             //Create Directory Base On Template
90 90
             Storage::makeDirectory($file_path);
91
-            Storage::put($file_path."/index.html","&nbsp;","public");
92
-            Storage::put($file_path."/.gitignore","!.gitignore","public");
91
+            Storage::put($file_path."/index.html", "&nbsp;", "public");
92
+            Storage::put($file_path."/.gitignore", "!.gitignore", "public");
93 93
 
94 94
             if ($encrypt == true) {
95 95
                 $filename = md5(strRandom(5)).'.'.$extension;
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
                 $filename = slug($filename, '_').'.'.$extension;
98 98
             }
99 99
 
100
-            if($resize_width || $resize_height) {
100
+            if ($resize_width || $resize_height) {
101 101
                 $this->resizeImage($file, $file_path.'/'.$filename, $resize_width, $resize_height);
102 102
                 return $file_path.'/'.$filename;
103
-            }else{
103
+            } else {
104 104
                 if (Storage::putFileAs($file_path, $file, $filename, 'public')) {
105 105
                     return $file_path.'/'.$filename;
106 106
                 } else {
107 107
                     throw new \Exception("Something went wrong, file can't upload!");
108 108
                 }
109 109
             }
110
-        }else{
110
+        } else {
111 111
             throw new \Exception("The file format is not allowed!");
112 112
         }
113 113
     }
@@ -123,16 +123,16 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $fileData = base64_decode($base64_value);
125 125
         $mime_type = finfo_buffer(finfo_open(), $fileData, FILEINFO_MIME_TYPE);
126
-        if($mime_type) {
127
-            if($mime_type = explode('/', $mime_type)) {
126
+        if ($mime_type) {
127
+            if ($mime_type = explode('/', $mime_type)) {
128 128
                 $ext = $mime_type[1];
129
-                if($filename && $ext) {
129
+                if ($filename && $ext) {
130 130
                     return $this->uploadFileProcess($filename, $ext, $fileData, $encrypt, $resize_width, $resize_height);
131 131
                 }
132
-            }else {
132
+            } else {
133 133
                 throw new \Exception("Mime type not found");
134 134
             }
135
-        }else{
135
+        } else {
136 136
             throw new \Exception("Mime type not found");
137 137
         }
138 138
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             $filename = $file->getClientOriginalName();
153 153
             $ext = strtolower($file->getClientOriginalExtension());
154 154
 
155
-            if($filename && $ext) {
155
+            if ($filename && $ext) {
156 156
                 return $this->uploadFileProcess($filename, $ext, $file, $encrypt, $resize_width, $resize_height);
157 157
             }
158 158
 
@@ -187,29 +187,29 @@  discard block
 block discarded – undo
187 187
             if ($resize_width && $resize_height) {
188 188
                 $img->fit($resize_width, $resize_height);
189 189
 
190
-            } elseif ($resize_width && ! $resize_height) {
190
+            } elseif ($resize_width && !$resize_height) {
191 191
 
192
-                $img->resize($resize_width, null, function ($constraint) {
192
+                $img->resize($resize_width, null, function($constraint) {
193 193
                     $constraint->aspectRatio();
194 194
                 });
195 195
 
196
-            } elseif (! $resize_width && $resize_height) {
196
+            } elseif (!$resize_width && $resize_height) {
197 197
 
198
-                $img->resize(null, $resize_height, function ($constraint) {
198
+                $img->resize(null, $resize_height, function($constraint) {
199 199
                     $constraint->aspectRatio();
200 200
                 });
201 201
 
202 202
             } else {
203 203
 
204 204
                 if ($img->width() > cbConfig("DEFAULT_IMAGE_MAX_WIDTH_RES")) {
205
-                    $img->resize(cbConfig("DEFAULT_IMAGE_MAX_WIDTH_RES"), null, function ($constraint) {
205
+                    $img->resize(cbConfig("DEFAULT_IMAGE_MAX_WIDTH_RES"), null, function($constraint) {
206 206
                         $constraint->aspectRatio();
207 207
                     });
208 208
                 }
209 209
             }
210 210
 
211 211
             Storage::put($fullFilePath, $img, 'public');
212
-        }else{
212
+        } else {
213 213
             throw new \Exception("The file format is not allowed!");
214 214
         }
215 215
     }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         $validator = Validator::make($input_arr, $rules, $messages);
323 323
         if ($validator->fails()) {
324 324
             $message = $validator->errors()->all();
325
-            throw new CBValidationException(implode("; ",$message));
325
+            throw new CBValidationException(implode("; ", $message));
326 326
         }
327 327
     }
328 328
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     public function findPrimaryKey($table)
335 335
     {
336 336
         $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey();
337
-        if(!$pk) {
337
+        if (!$pk) {
338 338
             return null;
339 339
         }
340 340
         return $pk->getColumns()[0];
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             $string_parameters_array = explode('&', $string_parameters);
384 384
             foreach ($string_parameters_array as $s) {
385 385
                 $part = explode('=', $s);
386
-                if(isset($part[0]) && isset($part[1])) {
386
+                if (isset($part[0]) && isset($part[1])) {
387 387
                     $name = htmlspecialchars(urldecode($part[0]));
388 388
                     $name = strip_tags($name);
389 389
                     $value = htmlspecialchars(urldecode($part[1]));
@@ -400,16 +400,16 @@  discard block
 block discarded – undo
400 400
 
401 401
 
402 402
     public function routeGet($prefix, $controller) {
403
-        $alias = str_replace("@"," ", $controller);
403
+        $alias = str_replace("@", " ", $controller);
404 404
         $alias = ucwords($alias);
405
-        $alias = str_replace(" ","",$alias);
405
+        $alias = str_replace(" ", "", $alias);
406 406
         Route::get($prefix, ['uses' => $controller, 'as' => $alias]);
407 407
     }
408 408
 
409 409
     public function routePost($prefix, $controller) {
410
-        $alias = str_replace("@"," ", $controller);
410
+        $alias = str_replace("@", " ", $controller);
411 411
         $alias = ucwords($alias);
412
-        $alias = str_replace(" ","",$alias);
412
+        $alias = str_replace(" ", "", $alias);
413 413
         Route::post($prefix, ['uses' => $controller, 'as' => $alias]);
414 414
     }
415 415
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 
443 443
         $prefix = trim($prefix, '/').'/';
444 444
 
445
-        if(substr($controller,0,1) != "\\") {
445
+        if (substr($controller, 0, 1) != "\\") {
446 446
             $controller = "\App\Http\Controllers\\".$controller;
447 447
         }
448 448
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
             if($resize_width || $resize_height) {
101 101
                 $this->resizeImage($file, $file_path.'/'.$filename, $resize_width, $resize_height);
102 102
                 return $file_path.'/'.$filename;
103
-            }else{
103
+            } else{
104 104
                 if (Storage::putFileAs($file_path, $file, $filename, 'public')) {
105 105
                     return $file_path.'/'.$filename;
106 106
                 } else {
107 107
                     throw new \Exception("Something went wrong, file can't upload!");
108 108
                 }
109 109
             }
110
-        }else{
110
+        } else{
111 111
             throw new \Exception("The file format is not allowed!");
112 112
         }
113 113
     }
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
                 if($filename && $ext) {
130 130
                     return $this->uploadFileProcess($filename, $ext, $fileData, $encrypt, $resize_width, $resize_height);
131 131
                 }
132
-            }else {
132
+            } else {
133 133
                 throw new \Exception("Mime type not found");
134 134
             }
135
-        }else{
135
+        } else{
136 136
             throw new \Exception("Mime type not found");
137 137
         }
138 138
     }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             }
210 210
 
211 211
             Storage::put($fullFilePath, $img, 'public');
212
-        }else{
212
+        } else{
213 213
             throw new \Exception("The file format is not allowed!");
214 214
         }
215 215
     }
Please login to merge, or discard this patch.