Passed
Push — master ( c9dd23...72fffe )
by Ferry
03:51
created
src/helpers/MiscellanousSingleton.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 
24 24
     public function hasData($key) {
25 25
         $data = $this->data;
26
-        if(isset($data[$key])) return true;
26
+        if (isset($data[$key])) return true;
27 27
         else return false;
28 28
     }
29 29
 
Please login to merge, or discard this patch.
src/helpers/SchemaHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
     public static function hasColumn($table, $column)
17 17
     {
18 18
         $columns = cb()->listAllColumns($table);
19
-        return in_array($column,$columns);
19
+        return in_array($column, $columns);
20 20
     }
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
src/helpers/Module.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
         try {
27 27
             $routeArray = request()->route()->getAction();
28 28
             $this->controller = class_basename($routeArray['controller']);
29
-            $this->controller = strtok($this->controller,"@");
29
+            $this->controller = strtok($this->controller, "@");
30 30
 
31 31
             $className = "\\".$routeArray["namespace"]."\\".$this->controller;
32
-            if(class_exists($className)) {
33
-                $this->module = cb()->find("cb_modules",["controller"=>$this->controller]);
34
-                if($this->module) {
32
+            if (class_exists($className)) {
33
+                $this->module = cb()->find("cb_modules", ["controller"=>$this->controller]);
34
+                if ($this->module) {
35 35
                     $this->controller_class = new $className();
36
-                    $this->menu = cb()->find("cb_menus",["cb_modules_id"=>$this->module->id]);
37
-                    $this->menu = (!$this->menu)?cb()->find("cb_menus",["type"=>"path","path"=>request()->segment(2)]):$this->menu;
38
-                    if($this->menu) {
39
-                        $this->privilege = cb()->find("cb_role_privileges",[
36
+                    $this->menu = cb()->find("cb_menus", ["cb_modules_id"=>$this->module->id]);
37
+                    $this->menu = (!$this->menu) ?cb()->find("cb_menus", ["type"=>"path", "path"=>request()->segment(2)]) : $this->menu;
38
+                    if ($this->menu) {
39
+                        $this->privilege = cb()->find("cb_role_privileges", [
40 40
                            "cb_menus_id"=>$this->menu->id,
41 41
                            "cb_roles_id"=>cb()->session()->roleId()
42 42
                         ]);
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
     }
58 58
 
59 59
     public function getData($key) {
60
-        if($this->controller_class) {
60
+        if ($this->controller_class) {
61 61
             $value = $this->controller_class->getData($key);
62
-            if(isset($value)) {
62
+            if (isset($value)) {
63 63
                 return $value;
64 64
             }
65 65
         }
@@ -70,128 +70,128 @@  discard block
 block discarded – undo
70 70
      * @return CBController
71 71
      */
72 72
     public function getController() {
73
-        return ($this->controller_class)?$this->controller_class:null;
73
+        return ($this->controller_class) ? $this->controller_class : null;
74 74
     }
75 75
 
76 76
     public function getPageTitle()
77 77
     {
78
-        return ($this->controller_class)?$this->controller_class->getData("page_title")?:cb()->getAppName():null;
78
+        return ($this->controller_class) ? $this->controller_class->getData("page_title") ?: cb()->getAppName() : null;
79 79
     }
80 80
 
81 81
     public function getTable()
82 82
     {
83
-        return ($this->controller_class)?$this->controller_class->getData("table"):null;
83
+        return ($this->controller_class) ? $this->controller_class->getData("table") : null;
84 84
     }
85 85
 
86 86
     public function getPageIcon()
87 87
     {
88
-        return ($this->controller_class)?$this->controller_class->getData('page_icon')?:"fa fa-bars":null;
88
+        return ($this->controller_class) ? $this->controller_class->getData('page_icon') ?: "fa fa-bars" : null;
89 89
     }
90 90
 
91 91
     public function canBrowse() {
92
-        if($this->privilege) {
93
-            if($this->privilege->can_browse) return true;
92
+        if ($this->privilege) {
93
+            if ($this->privilege->can_browse) return true;
94 94
             else return false;
95
-        }else{
95
+        } else {
96 96
             return true;
97 97
         }
98 98
     }
99 99
 
100 100
     public function canCreate() {
101
-        if($this->privilege) {
102
-            if($this->privilege->can_create) return true;
101
+        if ($this->privilege) {
102
+            if ($this->privilege->can_create) return true;
103 103
             else return false;
104
-        }else{
104
+        } else {
105 105
             return true;
106 106
         }
107 107
     }
108 108
 
109 109
     public function canRead() {
110
-        if($this->privilege) {
111
-            if($this->privilege->can_read) return true;
110
+        if ($this->privilege) {
111
+            if ($this->privilege->can_read) return true;
112 112
             else return false;
113
-        }else{
113
+        } else {
114 114
             return true;
115 115
         }
116 116
     }
117 117
 
118 118
     public function canUpdate() {
119
-        if($this->privilege) {
120
-            if($this->privilege->can_update) return true;
119
+        if ($this->privilege) {
120
+            if ($this->privilege->can_update) return true;
121 121
             else return false;
122
-        }else{
122
+        } else {
123 123
             return true;
124 124
         }
125 125
     }
126 126
 
127 127
     public function canDelete() {
128
-        if($this->privilege) {
129
-            if($this->privilege->can_delete) return true;
128
+        if ($this->privilege) {
129
+            if ($this->privilege->can_delete) return true;
130 130
             else return false;
131
-        }else{
131
+        } else {
132 132
             return true;
133 133
         }
134 134
     }
135 135
 
136 136
     public function addURL()
137 137
     {
138
-        if($this->controller_class && method_exists($this->controller_class, 'getAdd')) {
138
+        if ($this->controller_class && method_exists($this->controller_class, 'getAdd')) {
139 139
             return action($this->controller.'@getAdd');
140
-        }else{
140
+        } else {
141 141
             return null;
142 142
         }
143 143
     }
144 144
 
145 145
     public function addSaveURL()
146 146
     {
147
-        if($this->controller_class && method_exists($this->controller_class, 'postAddSave')) {
147
+        if ($this->controller_class && method_exists($this->controller_class, 'postAddSave')) {
148 148
             return action($this->controller.'@postAddSave');
149
-        }else{
149
+        } else {
150 150
             return null;
151 151
         }
152 152
     }
153 153
 
154 154
     public function editURL($id = null)
155 155
     {
156
-        if($this->controller_class && method_exists($this->controller_class, 'getEdit')) {
157
-            return action($this->controller.'@getEdit',['id'=>$id]);
158
-        }else{
156
+        if ($this->controller_class && method_exists($this->controller_class, 'getEdit')) {
157
+            return action($this->controller.'@getEdit', ['id'=>$id]);
158
+        } else {
159 159
             return null;
160 160
         }
161 161
     }
162 162
 
163 163
     public function editSaveURL($id = null)
164 164
     {
165
-        if(method_exists($this->controller_class, 'postEditSave')) {
166
-            return action($this->controller.'@postEditSave',['id'=>$id]);
167
-        }else{
165
+        if (method_exists($this->controller_class, 'postEditSave')) {
166
+            return action($this->controller.'@postEditSave', ['id'=>$id]);
167
+        } else {
168 168
             return null;
169 169
         }
170 170
     }
171 171
 
172
-    public function detailURL($id=null)
172
+    public function detailURL($id = null)
173 173
     {
174
-        if($this->controller_class && method_exists($this->controller_class, 'getDetail')) {
175
-            return action($this->controller.'@getDetail',['id'=>$id]);
176
-        }else{
174
+        if ($this->controller_class && method_exists($this->controller_class, 'getDetail')) {
175
+            return action($this->controller.'@getDetail', ['id'=>$id]);
176
+        } else {
177 177
             return null;
178 178
         }
179 179
     }
180 180
 
181
-    public function deleteURL($id=null)
181
+    public function deleteURL($id = null)
182 182
     {
183
-        if($this->controller_class && method_exists($this->controller_class, 'getDelete')) {
184
-            return action($this->controller.'@getDelete',['id'=>$id]);
185
-        }else{
183
+        if ($this->controller_class && method_exists($this->controller_class, 'getDelete')) {
184
+            return action($this->controller.'@getDelete', ['id'=>$id]);
185
+        } else {
186 186
             return null;
187 187
         }
188 188
     }
189 189
 
190 190
     public function url($path = null)
191 191
     {
192
-        if($this->controller_class && method_exists($this->controller_class, 'getIndex')) {
193
-            return trim(action($this->controller.'@getIndex').'/'.$path,'/');
194
-        }else{
192
+        if ($this->controller_class && method_exists($this->controller_class, 'getIndex')) {
193
+            return trim(action($this->controller.'@getIndex').'/'.$path, '/');
194
+        } else {
195 195
             return null;
196 196
         }
197 197
     }
Please login to merge, or discard this patch.
src/helpers/CacheHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public static function putInGroup($key, $value, $group, $duration) {
17 17
         $key = md5($key);
18
-        $exist = (Cache::get($group))?:[];
19
-        $exist[ $key ] = ['value'=>$value,'duration'=>$duration];
18
+        $exist = (Cache::get($group)) ?: [];
19
+        $exist[$key] = ['value'=>$value, 'duration'=>$duration];
20 20
 
21
-        if($duration == -1) {
21
+        if ($duration == -1) {
22 22
             Cache::forever($group, $exist);
23 23
         } else {
24 24
             Cache::put($group, $exist, $duration);
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public static function getItemInGroup($key, $group) {
29 29
         $groupdata = Cache::get($group);
30 30
         $key = md5($key);
31
-        if(isset($groupdata[$key])) {
31
+        if (isset($groupdata[$key])) {
32 32
             return $groupdata[$key]['value'];
33 33
         }
34 34
         return null;
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
         Cache::forget($group);
39 39
     }
40 40
 
41
-    public static function forgetInGroup($key,$group) {
41
+    public static function forgetInGroup($key, $group) {
42 42
         $key = md5($key);
43 43
         $data = Cache::get($group);
44 44
         $duration = null;
45
-        if(isset($data[$key])) {
45
+        if (isset($data[$key])) {
46 46
             $item = $data[$key];
47 47
             unset($data[$key]);
48 48
         }
Please login to merge, or discard this patch.
src/controllers/DeveloperSecurityController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function getIndex() {
26 26
         $data = [];
27
-        return view($this->view.".index",$data);
27
+        return view($this->view.".index", $data);
28 28
     }
29 29
 
30 30
     public function postSave()
31 31
     {
32
-        if(!isConfigCached()) {
32
+        if (!isConfigCached()) {
33 33
             setEnvironmentValue([
34 34
                 "APP_DEBUG"=>request("APP_DEBUG")
35 35
             ]);
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
         putSetting("AUTO_REDIRECT_TO_LOGIN", request("AUTO_REDIRECT_TO_LOGIN"));
42 42
         putSetting("LOGIN_NOTIFICATION", request("LOGIN_NOTIFICATION"));
43 43
 
44
-        if(request("htaccess_ServerSignature")) {
44
+        if (request("htaccess_ServerSignature")) {
45 45
             putHtaccess("ServerSignature Off");
46 46
         }
47 47
 
48
-        if(request("htaccess_IndexIgnore")) {
48
+        if (request("htaccess_IndexIgnore")) {
49 49
             putHtaccess("IndexIgnore *");
50 50
         }
51 51
 
52
-        if(request("htaccess_dotAccess")) {
52
+        if (request("htaccess_dotAccess")) {
53 53
 putHtaccess("
54 54
 <FilesMatch \"^\.\">
55 55
 Order allow,deny
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 </FilesMatch>");
58 58
         }
59 59
 
60
-        if(request("htaccess_preventVendor")) {
60
+        if (request("htaccess_preventVendor")) {
61 61
             putHtaccess("RewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]");
62 62
         }
63 63
 
64 64
 
65
-        return cb()->redirectBack("Security has been updated!","success");
65
+        return cb()->redirectBack("Security has been updated!", "success");
66 66
     }
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
src/CRUDBoosterServiceProvider.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
         // Register views
27 27
         $this->loadViewsFrom(__DIR__.'/views', 'crudbooster');
28 28
         $this->loadViewsFrom(__DIR__.'/types', 'types');
29
-        $this->loadTranslationsFrom(__DIR__."/localization","cb");
29
+        $this->loadTranslationsFrom(__DIR__."/localization", "cb");
30 30
 
31 31
         // Publish the files
32
-        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')],'cb_config');
33
-        $this->publishes([__DIR__.'/database' => base_path('database')],'cb_migration');
34
-        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')],'cb_hook');
35
-        $this->publishes([__DIR__ . '/assets' =>public_path('cb_asset')],'cb_asset');
32
+        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')], 'cb_config');
33
+        $this->publishes([__DIR__.'/database' => base_path('database')], 'cb_migration');
34
+        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')], 'cb_hook');
35
+        $this->publishes([__DIR__.'/assets' =>public_path('cb_asset')], 'cb_asset');
36 36
 
37 37
         // Override Local FileSystem
38 38
         Config::set("filesystems.disks.local.root", cbConfig("LOCAL_FILESYSTEM_PATH", public_path("storage")));
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         require __DIR__.'/helpers/Helper.php';
55 55
 
56 56
         // Singletons
57
-        $this->app->singleton('crudbooster', function ()
57
+        $this->app->singleton('crudbooster', function()
58 58
         {
59 59
             return true;
60 60
         });
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         }
78 78
 
79 79
         // Merging configuration
80
-        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php','crudbooster');
80
+        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php', 'crudbooster');
81 81
 
82 82
         // Register additional library
83 83
         $this->app->register('Intervention\Image\ImageServiceProvider');
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 
89 89
     private function registerPlugin()
90 90
     {
91
-        if(file_exists(app_path("CBPlugins"))) {
91
+        if (file_exists(app_path("CBPlugins"))) {
92 92
             $views = scandir(app_path("CBPlugins"));
93
-            foreach($views as $view) {
94
-                if($view != "." && $view != "..") {
93
+            foreach ($views as $view) {
94
+                if ($view != "." && $view != "..") {
95 95
                     $basename = basename($view);
96 96
                     // register view
97
-                    $this->loadViewsFrom(app_path("CBPlugins".DIRECTORY_SEPARATOR.$basename.DIRECTORY_SEPARATOR."Views"),$basename);
97
+                    $this->loadViewsFrom(app_path("CBPlugins".DIRECTORY_SEPARATOR.$basename.DIRECTORY_SEPARATOR."Views"), $basename);
98 98
                     // register route
99 99
                     require app_path("CBPlugins".DIRECTORY_SEPARATOR.$basename.DIRECTORY_SEPARATOR."Routes".DIRECTORY_SEPARATOR."Route.php");
100 100
                 }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
     private function registerTypeRoutes() {
108 108
         $routes = rglob(__DIR__.DIRECTORY_SEPARATOR."types".DIRECTORY_SEPARATOR."Route.php");
109
-        foreach($routes as $route) {
109
+        foreach ($routes as $route) {
110 110
             require $route;
111 111
         }
112 112
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperPluginStoreController.php 1 patch
Spacing   +38 added lines, -38 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,28 +89,28 @@  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
 
104
-    private function recursiveCopy($src,$dst) {
104
+    private function recursiveCopy($src, $dst) {
105 105
         $dir = opendir($src);
106 106
         @mkdir($dst);
107
-        while(false !== ( $file = readdir($dir)) ) {
108
-            if (( $file != '.' ) && ( $file != '..' )) {
109
-                if ( is_dir($src . '/' . $file) ) {
110
-                    $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file);
107
+        while (false !== ($file = readdir($dir))) {
108
+            if (($file != '.') && ($file != '..')) {
109
+                if (is_dir($src.'/'.$file)) {
110
+                    $this->recursiveCopy($src.'/'.$file, $dst.'/'.$file);
111 111
                 }
112 112
                 else {
113
-                    copy($src . '/' . $file,$dst . '/' . $file);
113
+                    copy($src.'/'.$file, $dst.'/'.$file);
114 114
                 }
115 115
             }
116 116
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $pluginData = $this->fetchPluginData();
123 123
 
124 124
         try {
125
-            if(isset($pluginData[$key])) {
125
+            if (isset($pluginData[$key])) {
126 126
                 $plugin = $pluginData[$key];
127 127
 
128 128
                 // Create temp file of zip plugin
@@ -140,16 +140,16 @@  discard block
 block discarded – undo
140 140
                     fclose($temp);
141 141
 
142 142
                     // Rename
143
-                    if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
143
+                    if (file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
144 144
                     rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key));
145 145
 
146 146
                     // Read Plugin JSON
147 147
                     $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$key."/plugin.json")), true);
148 148
 
149 149
                     // Check if has asset
150
-                    if($pluginJson && $pluginJson['asset']) {
150
+                    if ($pluginJson && $pluginJson['asset']) {
151 151
                         // Check destination folder is ready
152
-                        if(file_exists(public_path("cb_asset/".$key))) {
152
+                        if (file_exists(public_path("cb_asset/".$key))) {
153 153
                             rrmdir(public_path("cb_asset/".$key));
154 154
                         }
155 155
 
@@ -160,22 +160,22 @@  discard block
 block discarded – undo
160 160
                         $this->recursiveCopy(app_path("CBPlugins/".$key."/".$pluginJson['asset']), public_path("cb_asset/".$key));
161 161
                     }
162 162
 
163
-                    return response()->json(['status'=>true,'message'=>'Install / update plugin has been succesfull!']);
163
+                    return response()->json(['status'=>true, 'message'=>'Install / update plugin has been succesfull!']);
164 164
 
165 165
                 } else {
166
-                    return response()->json(['status'=>false,'message'=>"Failed to install/update, can't open the plugin archive"]);
166
+                    return response()->json(['status'=>false, 'message'=>"Failed to install/update, can't open the plugin archive"]);
167 167
                 }
168
-            }else{
169
-                return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']);
168
+            } else {
169
+                return response()->json(['status'=>false, 'message'=>'Failed to install/update, plugin key is not found']);
170 170
             }
171 171
         } catch (\Exception $e) {
172
-            return response()->json(['status'=>false,'message'=>'Something went wrong!']);
172
+            return response()->json(['status'=>false, 'message'=>'Something went wrong!']);
173 173
         }
174 174
     }
175 175
 
176 176
     private function fetchPluginData($cache = true)
177 177
     {
178
-        if($cache === true && $data = Cache::get("plugin_store_data")) {
178
+        if ($cache === true && $data = Cache::get("plugin_store_data")) {
179 179
             return $data;
180 180
         }
181 181
 
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
             $context = stream_context_create($opts);
193 193
             $data = file_get_contents(base64_decode("aHR0cDovL2NydWRib29zdGVyLmNvbS9hcGkvcGx1Z2luP2FjY2Vzc190b2tlbj1iVmMvWm5wWU5TWnJNVlpZT0hFNVUydHFjU1U9"), false, $context);
194 194
 
195
-            if($data) {
195
+            if ($data) {
196 196
                 $data = json_decode($data, true);
197
-                if($data['status']==true) {
197
+                if ($data['status'] == true) {
198 198
 
199
-                    foreach($data['data'] as $item) {
199
+                    foreach ($data['data'] as $item) {
200 200
                         $key = $item['key'];
201
-                        $result[ $key ] = $item;
201
+                        $result[$key] = $item;
202 202
                     }
203 203
 
204 204
                     $result = collect($result)->sortBy("name")->all();
Please login to merge, or discard this patch.
src/configs/crudbooster.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
     /*
21 21
      * For security reason we have limit the upload file formats bellow
22 22
      */
23
-    'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif','pdf','xls','xlsx','doc','docx','txt','zip','rar','rtf'],
23
+    'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif', 'pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt', 'zip', 'rar', 'rtf'],
24 24
 
25
-    'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif'],
25
+    'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif'],
26 26
 
27 27
     /*
28 28
      * Override Local FileSystem From Storage To Another
@@ -58,5 +58,5 @@  discard block
 block discarded – undo
58 58
      * You can define in this array what the tables you want to include in "php artisan crudbooster:data_migration"
59 59
      * The default is all cb_ prefix will be include in data migration
60 60
      */
61
-    'ADDITIONAL_DATA_MIGRATION'=>['users','migrations']
61
+    'ADDITIONAL_DATA_MIGRATION'=>['users', 'migrations']
62 62
 ];
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
src/controllers/AdminAuthController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,31 +20,31 @@  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
     public function postLogin()
38 38
     {
39
-        try{
40
-            if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
39
+        try {
40
+            if ($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
41 41
 
42 42
             cb()->validation([
43 43
                 'email'=>'required|email',
44 44
                 'password'=>'required'
45 45
             ]);
46 46
 
47
-            $credential = request()->only(['email','password']);
47
+            $credential = request()->only(['email', 'password']);
48 48
             if (auth()->attempt($credential)) {
49 49
 
50 50
                 // When login user success, clear suspend attempt
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
                 return redirect(cb()->getAdminUrl());
56 56
             } else {
57 57
                 $this->incrementFailedLogin();
58
-                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']);
58
+                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'), 'message_type'=>'warning']);
59 59
             }
60
-        }catch (CBValidationException $e) {
61
-            return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
60
+        } catch (CBValidationException $e) {
61
+            return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning');
62 62
         }
63 63
     }
64 64
 
Please login to merge, or discard this patch.