Passed
Push — master ( 72fffe...b949dd )
by Ferry
04:19
created
src/routes.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,61 +1,61 @@  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
-        cb()->routeGet("login-verification","AdminAuthController@getLoginVerification");
45
-        cb()->routePost("submit-login-verification","AdminAuthController@postSubmitLoginVerification");
44
+        cb()->routeGet("login-verification", "AdminAuthController@getLoginVerification");
45
+        cb()->routePost("submit-login-verification", "AdminAuthController@postSubmitLoginVerification");
46 46
     }
47 47
 
48
-    if(getSetting("enable_forget")) {
49
-        cb()->routePost("forget","AdminAuthController@postForget");
48
+    if (getSetting("enable_forget")) {
49
+        cb()->routePost("forget", "AdminAuthController@postForget");
50 50
     }
51 51
 
52
-    if(getSetting("enable_register")) {
53
-        cb()->routePost("register","AdminAuthController@postRegister");
52
+    if (getSetting("enable_register")) {
53
+        cb()->routePost("register", "AdminAuthController@postRegister");
54 54
     }
55 55
 });
56 56
 
57 57
 // Routing package controllers
58
-cb()->routeGroupBackend(function () {
58
+cb()->routeGroupBackend(function() {
59 59
     cb()->routeController('profile', '\crocodicstudio\crudbooster\controllers\AdminProfileController');
60 60
 });
61 61
 
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
     'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBBackend::class],
65 65
     'prefix' => cb()->getAdminPath(),
66 66
     'namespace' => 'App\Http\Controllers',
67
-], function () {
67
+], function() {
68 68
 
69 69
     if (Request::is(cb()->getAdminPath())) {
70
-        if($dashboard = getSetting("dashboard_controller")) {
70
+        if ($dashboard = getSetting("dashboard_controller")) {
71 71
             cb()->routeGet("/", $dashboard."@getIndex");
72
-        }else{
72
+        } else {
73 73
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
74 74
         }
75 75
     }
76 76
 
77 77
     $controllers = glob(app_path('Http/Controllers/Admin*Controller.php'));
78 78
 
79
-    foreach($controllers as $controller) {
79
+    foreach ($controllers as $controller) {
80 80
         $controllerName = basename($controller);
81
-        $controllerName = rtrim($controllerName,".php");
81
+        $controllerName = rtrim($controllerName, ".php");
82 82
         $className = '\App\Http\Controllers\\'.$controllerName;
83 83
         $controllerClass = new $className();
84
-        if(method_exists($controllerClass, 'cbInit')) {
84
+        if (method_exists($controllerClass, 'cbInit')) {
85 85
             cb()->routeController($controllerClass->getData('permalink'), $controllerName);
86 86
         }
87 87
     }
Please login to merge, or discard this patch.
src/controllers/AdminAuthController.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -132,9 +132,9 @@
 block discarded – undo
132 132
 
133 133
                 // Update Login At
134 134
                 cb()->update("users", auth()->id(), [
135
-                   "login_at"=>now()->format("Y-m-d H:i:s"),
136
-                   "ip_address"=>request()->ip(),
137
-                   "user_agent"=>request()->userAgent()
135
+                    "login_at"=>now()->format("Y-m-d H:i:s"),
136
+                    "ip_address"=>request()->ip(),
137
+                    "user_agent"=>request()->userAgent()
138 138
                 ]);
139 139
 
140 140
                 // When login user success, clear suspend attempt
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,32 +20,32 @@  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 32
         $themeView = getThemePath("login");
33
-        $loginView = str_replace(".blade.php", "", getSetting('login_page_view',$themeView));
34
-        return view($loginView, $data );
33
+        $loginView = str_replace(".blade.php", "", getSetting('login_page_view', $themeView));
34
+        return view($loginView, $data);
35 35
     }
36 36
 
37 37
     private function loginNotification() {
38
-        if($isLoginNotification = getSetting("LOGIN_NOTIFICATION")) {
38
+        if ($isLoginNotification = getSetting("LOGIN_NOTIFICATION")) {
39 39
             $user = auth()->user();
40
-            if($user->ip_address && $user->user_agent) {
40
+            if ($user->ip_address && $user->user_agent) {
41 41
 
42
-                if( request()->ip() != $user->ip_address || request()->userAgent() != $user->user_agent) {
42
+                if (request()->ip() != $user->ip_address || request()->userAgent() != $user->user_agent) {
43 43
                     $code = Str::random(5);
44 44
                     session(["login_verification_code"=>$code]);
45 45
                     $mail = new MailHelper();
46 46
                     $mail->to($user->email);
47
-                    $mail->sender("noreply@".$_SERVER['SERVER_NAME'],cb()->getAppName());
48
-                    $mail->content("Please verify that it's you?","
47
+                    $mail->sender("noreply@".$_SERVER['SERVER_NAME'], cb()->getAppName());
48
+                    $mail->content("Please verify that it's you?", "
49 49
                     Hi $user->name,<br/><br>
50 50
                     
51 51
                     Your sign in attempt seems a little different than usual. This could be because you are signing in from a different device or a different location.<br/>
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
         try {
87 87
             cb()->validation(["code"]);
88 88
 
89
-            if(session()->has("login_verification_code")) {
89
+            if (session()->has("login_verification_code")) {
90 90
                 $sessCode = session("login_verification_code");
91
-                if(request("code") == $sessCode) {
91
+                if (request("code") == $sessCode) {
92 92
                     // Update Login At
93 93
                     cb()->update("users", auth()->id(), [
94 94
                         "login_at"=>now()->format("Y-m-d H:i:s"),
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                 }
106 106
             }
107 107
 
108
-            return cb()->redirectBack("The code is invalid!","warning");
108
+            return cb()->redirectBack("The code is invalid!", "warning");
109 109
 
110 110
         } catch (CBValidationException $e) {
111 111
             return cb()->redirectBack($e->getMessage());
@@ -114,20 +114,20 @@  discard block
 block discarded – undo
114 114
 
115 115
     public function postLogin()
116 116
     {
117
-        try{
118
-            if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
117
+        try {
118
+            if ($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
119 119
 
120 120
             cb()->validation([
121 121
                 'email'=>'required|email',
122 122
                 'password'=>'required'
123 123
             ]);
124 124
 
125
-            $credential = request()->only(['email','password']);
125
+            $credential = request()->only(['email', 'password']);
126 126
             if (auth()->attempt($credential)) {
127 127
 
128 128
                 // Check if login notification is enabled
129
-                if($this->loginNotification()) {
130
-                    return cb()->redirect(route("AdminAuthControllerGetLoginVerification"),"We have sent you a code verification, please enter to this box");
129
+                if ($this->loginNotification()) {
130
+                    return cb()->redirect(route("AdminAuthControllerGetLoginVerification"), "We have sent you a code verification, please enter to this box");
131 131
                 }
132 132
 
133 133
                 // Update Login At
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
                 return redirect(cb()->getAdminUrl());
146 146
             } else {
147 147
                 $this->incrementFailedLogin();
148
-                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']);
148
+                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'), 'message_type'=>'warning']);
149 149
             }
150
-        }catch (CBValidationException $e) {
151
-            return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
150
+        } catch (CBValidationException $e) {
151
+            return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning');
152 152
         }
153 153
     }
154 154
 
Please login to merge, or discard this patch.
src/controllers/DeveloperPluginStoreController.php 2 patches
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function getIndex() {
32 32
 
33
-        if(request("refresh")) {
34
-            $this->fetchPluginData(false );
35
-            return cb()->redirectBack("Plugin list has been refreshed!","success");
33
+        if (request("refresh")) {
34
+            $this->fetchPluginData(false);
35
+            return cb()->redirectBack("Plugin list has been refreshed!", "success");
36 36
         }
37 37
 
38 38
         $data = [];
39 39
         $data['result'] = $this->fetchPluginData();
40
-        return view($this->view.'.index',$data);
40
+        return view($this->view.'.index', $data);
41 41
     }
42 42
 
43 43
     public function postLoginAccount() {
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
         ]);
53 53
         $response = $curl->send();
54 54
 
55
-        if($respArray = json_decode($response, true)) {
56
-            if($respArray['status'] && isset($respArray['token'])) {
55
+        if ($respArray = json_decode($response, true)) {
56
+            if ($respArray['status'] && isset($respArray['token'])) {
57 57
                 session(['account_token'=>$respArray['token']]);
58 58
             }
59
-            return response()->make($response,200,["Content-Type"=>"application/json"]);
59
+            return response()->make($response, 200, ["Content-Type"=>"application/json"]);
60 60
         } else {
61
-            return response()->json(['status'=>false,'message'=>'failed']);
61
+            return response()->json(['status'=>false, 'message'=>'failed']);
62 62
         }
63 63
     }
64 64
 
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
         ]);
76 76
         $response = $curl->send();
77 77
 
78
-        if($respArray = json_decode($response, true)) {
79
-            if($respArray['status']) {
78
+        if ($respArray = json_decode($response, true)) {
79
+            if ($respArray['status']) {
80 80
                 $form = base64_decode($respArray['payment']);
81
-                return response()->json(['status'=>true,'form'=>$form]);
81
+                return response()->json(['status'=>true, 'form'=>$form]);
82 82
             } else {
83 83
                 return response()->json($respArray);
84 84
             }
85 85
         } else {
86
-            return response()->json(['status'=>false,'message'=>'failed','raw'=>$response]);
86
+            return response()->json(['status'=>false, 'message'=>'failed', 'raw'=>$response]);
87 87
         }
88 88
     }
89 89
 
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $pluginData = $this->fetchPluginData();
93 93
 
94
-        if(isset($pluginData[$key])) {
95
-            if(file_exists(app_path("CBPlugins/".$key))) {
94
+        if (isset($pluginData[$key])) {
95
+            if (file_exists(app_path("CBPlugins/".$key))) {
96 96
 
97
-                if(isset($pluginData['source']) && $pluginData['source'] == 'composer') {
98
-                    if(isset($pluginData['package'])) {
97
+                if (isset($pluginData['source']) && $pluginData['source'] == 'composer') {
98
+                    if (isset($pluginData['package'])) {
99 99
                         ComposerHelper::composerRemove($pluginData['package']);
100 100
                     }
101 101
                 }
@@ -103,24 +103,24 @@  discard block
 block discarded – undo
103 103
                 rrmdir(app_path("CBPlugins/".$key));
104 104
 
105 105
                 return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']);
106
-            }else{
107
-                return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']);
106
+            } else {
107
+                return response()->json(['status'=>false, 'message'=>'Failed to uninstall, plugin is not found']);
108 108
             }
109
-        }else {
110
-            return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']);
109
+        } else {
110
+            return response()->json(['status'=>false, 'message'=>'Failed to uninstall, plugin key is not found']);
111 111
         }
112 112
     }
113 113
 
114
-    private function recursiveCopy($src,$dst) {
114
+    private function recursiveCopy($src, $dst) {
115 115
         $dir = opendir($src);
116 116
         @mkdir($dst);
117
-        while(false !== ( $file = readdir($dir)) ) {
118
-            if (( $file != '.' ) && ( $file != '..' )) {
119
-                if ( is_dir($src . '/' . $file) ) {
120
-                    $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file);
117
+        while (false !== ($file = readdir($dir))) {
118
+            if (($file != '.') && ($file != '..')) {
119
+                if (is_dir($src.'/'.$file)) {
120
+                    $this->recursiveCopy($src.'/'.$file, $dst.'/'.$file);
121 121
                 }
122 122
                 else {
123
-                    copy($src . '/' . $file,$dst . '/' . $file);
123
+                    copy($src.'/'.$file, $dst.'/'.$file);
124 124
                 }
125 125
             }
126 126
         }
@@ -129,24 +129,24 @@  discard block
 block discarded – undo
129 129
 
130 130
     public function getInstall($key)
131 131
     {
132
-        ini_set("memory_limit","192M");
132
+        ini_set("memory_limit", "192M");
133 133
         set_time_limit(500);
134 134
 
135 135
         $pluginData = $this->fetchPluginData();
136 136
 
137 137
         try {
138
-            if(isset($pluginData[$key])) {
138
+            if (isset($pluginData[$key])) {
139 139
                 $plugin = $pluginData[$key];
140 140
 
141
-                if(isset($plugin['source']) && $plugin['source'] == "composer") {
141
+                if (isset($plugin['source']) && $plugin['source'] == "composer") {
142 142
 
143
-                    if(isset($plugin['package']) && isset($plugin['service_provider'])) {
143
+                    if (isset($plugin['package']) && isset($plugin['service_provider'])) {
144 144
                         // Make a composer
145 145
                         $output = ComposerHelper::composerRequire($plugin['package'], $plugin['service_provider']);
146 146
 
147
-                        return response()->json(['status'=>true,'message'=>$output]);
147
+                        return response()->json(['status'=>true, 'message'=>$output]);
148 148
                     } else {
149
-                        return response()->json(['status'=>true,'message'=>'Installation is failed, there is no package and or service provider']);
149
+                        return response()->json(['status'=>true, 'message'=>'Installation is failed, there is no package and or service provider']);
150 150
                     }
151 151
 
152 152
                 } else {
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
                         fclose($temp);
166 166
 
167 167
                         // Rename
168
-                        if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
168
+                        if (file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
169 169
                         rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key));
170 170
 
171 171
                         // Read Plugin JSON
172 172
                         $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$key."/plugin.json")), true);
173 173
 
174 174
                         // Check if has asset
175
-                        if($pluginJson && $pluginJson['asset']) {
175
+                        if ($pluginJson && $pluginJson['asset']) {
176 176
                             // Check destination folder is ready
177
-                            if(file_exists(public_path("cb_asset/".$key))) {
177
+                            if (file_exists(public_path("cb_asset/".$key))) {
178 178
                                 rrmdir(public_path("cb_asset/".$key));
179 179
                             }
180 180
 
@@ -185,31 +185,31 @@  discard block
 block discarded – undo
185 185
                             $this->recursiveCopy(app_path("CBPlugins/".$key."/".$pluginJson['asset']), public_path("cb_asset/".$key));
186 186
                         }
187 187
 
188
-                        return response()->json(['status'=>true,'message'=>'Install / update plugin has been succesfull!']);
188
+                        return response()->json(['status'=>true, 'message'=>'Install / update plugin has been succesfull!']);
189 189
 
190 190
                     } else {
191
-                        return response()->json(['status'=>false,'message'=>"Failed to install/update, can't open the plugin archive"]);
191
+                        return response()->json(['status'=>false, 'message'=>"Failed to install/update, can't open the plugin archive"]);
192 192
                     }
193 193
                 }
194 194
 
195
-            }else{
196
-                return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']);
195
+            } else {
196
+                return response()->json(['status'=>false, 'message'=>'Failed to install/update, plugin key is not found']);
197 197
             }
198 198
         } catch (\Exception $e) {
199
-            return response()->json(['status'=>false,'message'=>'Something went wrong!']);
199
+            return response()->json(['status'=>false, 'message'=>'Something went wrong!']);
200 200
         }
201 201
     }
202 202
 
203 203
     private function fetchPluginData($cache = true)
204 204
     {
205
-        if($cache === true && $data = Cache::get("plugin_store_data")) {
205
+        if ($cache === true && $data = Cache::get("plugin_store_data")) {
206 206
             return $data;
207 207
         }
208 208
 
209 209
         $result = [];
210 210
 
211 211
         try {
212
-            $no_cache = ($cache)?0:1;
212
+            $no_cache = ($cache) ? 0 : 1;
213 213
             $opts = [
214 214
                 "http" => [
215 215
                     "method" => "GET",
@@ -218,17 +218,17 @@  discard block
 block discarded – undo
218 218
                                 "No-Cache: ".$no_cache
219 219
                 ]
220 220
             ];
221
-            Log::debug("Headers: ".print_r($opts,true));
221
+            Log::debug("Headers: ".print_r($opts, true));
222 222
             $context = stream_context_create($opts);
223 223
             $data = file_get_contents(base64_decode("aHR0cDovL2NydWRib29zdGVyLmNvbS9hcGkvcGx1Z2luP2FjY2Vzc190b2tlbj1iVmMvWm5wWU5TWnJNVlpZT0hFNVUydHFjU1U9"), false, $context);
224 224
             Log::debug("Plugin API : ".$data);
225
-            if($data) {
225
+            if ($data) {
226 226
                 $data = json_decode($data, true);
227
-                if($data['status']==true) {
227
+                if ($data['status'] == true) {
228 228
 
229
-                    foreach($data['data'] as $item) {
229
+                    foreach ($data['data'] as $item) {
230 230
                         $key = $item['key'];
231
-                        $result[ $key ] = $item;
231
+                        $result[$key] = $item;
232 232
                     }
233 233
 
234 234
                     $result = collect($result)->sortBy("name")->all();
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
                 rrmdir(app_path("CBPlugins/".$key));
104 104
 
105 105
                 return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']);
106
-            }else{
106
+            } else{
107 107
                 return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']);
108 108
             }
109
-        }else {
109
+        } else {
110 110
             return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']);
111 111
         }
112 112
     }
@@ -118,8 +118,7 @@  discard block
 block discarded – undo
118 118
             if (( $file != '.' ) && ( $file != '..' )) {
119 119
                 if ( is_dir($src . '/' . $file) ) {
120 120
                     $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file);
121
-                }
122
-                else {
121
+                } else {
123 122
                     copy($src . '/' . $file,$dst . '/' . $file);
124 123
                 }
125 124
             }
@@ -165,7 +164,9 @@  discard block
 block discarded – undo
165 164
                         fclose($temp);
166 165
 
167 166
                         // Rename
168
-                        if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
167
+                        if(file_exists(app_path("CBPlugins/".$key))) {
168
+                            rrmdir(app_path("CBPlugins/".$key));
169
+                        }
169 170
                         rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key));
170 171
 
171 172
                         // Read Plugin JSON
@@ -192,7 +193,7 @@  discard block
 block discarded – undo
192 193
                     }
193 194
                 }
194 195
 
195
-            }else{
196
+            } else{
196 197
                 return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']);
197 198
             }
198 199
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/database/migrations/2016_08_07_152421_modify_users.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::table('users', function (Blueprint $table) {
15
+        Schema::table('users', function(Blueprint $table) {
16 16
             $table->string('photo')->nullable();
17 17
             $table->integer('cb_roles_id');
18 18
             $table->ipAddress("ip_address")->nullable();
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function down()
30 30
     {
31
-        Schema::table('users', function (Blueprint $table) {
32
-            $table->dropColumn(["photo","cb_roles_id","ip_address","user_agent","login_at"]);
31
+        Schema::table('users', function(Blueprint $table) {
32
+            $table->dropColumn(["photo", "cb_roles_id", "ip_address", "user_agent", "login_at"]);
33 33
         });
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/helpers/ComposerHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
         $process->setInput("Y");
56 56
         $process->setWorkingDirectory(base_path())->run();
57 57
 
58
-        Artisan::call("vendor:publish",["--provider"=>$serviceProvider]);
58
+        Artisan::call("vendor:publish", ["--provider"=>$serviceProvider]);
59 59
 
60 60
         return $process->getOutput();
61 61
     }
Please login to merge, or discard this patch.