Passed
Push — master ( 3c2be5...ef5ef1 )
by Ferry
03:56
created
src/helpers/CB.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 {
19 19
 
20 20
     public function getRoleByName($roleName) {
21
-        return $this->find("cb_roles",['name'=>$roleName]);
21
+        return $this->find("cb_roles", ['name'=>$roleName]);
22 22
     }
23 23
 
24 24
     public function fcm() {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     }
35 35
 
36 36
     public function getDeveloperUrl($path = null) {
37
-        $path = ($path)?"/".trim($path,"/"):null;
37
+        $path = ($path) ? "/".trim($path, "/") : null;
38 38
         return url(cbConfig("DEV_PATH")).$path;
39 39
     }
40 40
 
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     public function getAdminUrl($path = null) {
54
-        $path = ($path)?"/".trim($path,"/"):null;
54
+        $path = ($path) ? "/".trim($path, "/") : null;
55 55
         return url(cbConfig("ADMIN_PATH")).$path;
56 56
     }
57 57
 
58 58
     public function getAppName() {
59
-        return env("APP_NAME","CRUDBOOSTER");
59
+        return env("APP_NAME", "CRUDBOOSTER");
60 60
     }
61 61
 
62 62
     /**
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $fileData = base64_decode($value);
69 69
         $mime_type = finfo_buffer(finfo_open(), $fileData, FILEINFO_MIME_TYPE);
70
-        if($mime_type) {
71
-            if($mime_type = explode('/', $mime_type)) {
70
+        if ($mime_type) {
71
+            if ($mime_type = explode('/', $mime_type)) {
72 72
                 $ext = $mime_type[1];
73
-                if($ext) {
73
+                if ($ext) {
74 74
                     $filePath = 'uploads/'.date('Y-m');
75 75
                     Storage::makeDirectory($filePath);
76 76
                     $filename = sha1(strRandom(5)).'.'.$ext;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
             $file = request()->file($name);
100 100
             $ext = strtolower($file->getClientOriginalExtension());
101
-            if(in_array($ext,cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
101
+            if (in_array($ext, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
102 102
                 $filename = slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME));
103 103
                 $file_path = 'uploads/'.date('Y-m');
104 104
 
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
                 }
113 113
 
114 114
                 if (Storage::putFileAs($file_path, $file, $filename)) {
115
-                    if($resize_width || $resize_height) {
115
+                    if ($resize_width || $resize_height) {
116 116
                         $this->resizeImage($file_path.'/'.$filename, $resize_width, $resize_height);
117 117
                     }
118 118
                     return $file_path.'/'.$filename;
119 119
                 } else {
120 120
                     throw new \Exception("Something went wrong, file can't upload!");
121 121
                 }
122
-            }else{
122
+            } else {
123 123
                 throw new \Exception("The file format is not allowed!");
124 124
             }
125 125
 
@@ -142,22 +142,22 @@  discard block
 block discarded – undo
142 142
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
143 143
                 $img->fit($resize_width, $resize_height);
144 144
                 $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty);
145
-            } elseif ($resize_width && ! $resize_height) {
145
+            } elseif ($resize_width && !$resize_height) {
146 146
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
147
-                $img->resize($resize_width, null, function ($constraint) {
147
+                $img->resize($resize_width, null, function($constraint) {
148 148
                     $constraint->aspectRatio();
149 149
                 });
150 150
                 $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty);
151
-            } elseif (! $resize_width && $resize_height) {
151
+            } elseif (!$resize_width && $resize_height) {
152 152
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
153
-                $img->resize(null, $resize_height, function ($constraint) {
153
+                $img->resize(null, $resize_height, function($constraint) {
154 154
                     $constraint->aspectRatio();
155 155
                 });
156 156
                 $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty);
157 157
             } else {
158 158
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
159 159
                 if ($img->width() > 1300) {
160
-                    $img->resize(1300, null, function ($constraint) {
160
+                    $img->resize(1300, null, function($constraint) {
161 161
                         $constraint->aspectRatio();
162 162
                     });
163 163
                 }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         $validator = Validator::make($input_arr, $rules, $messages);
270 270
         if ($validator->fails()) {
271 271
             $message = $validator->errors()->all();
272
-            throw new CBValidationException(implode("; ",$message));
272
+            throw new CBValidationException(implode("; ", $message));
273 273
         }
274 274
     }
275 275
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     public function findPrimaryKey($table)
282 282
     {
283 283
         $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey();
284
-        if(!$pk) {
284
+        if (!$pk) {
285 285
             return null;
286 286
         }
287 287
         return $pk->getColumns()[0];
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             $string_parameters_array = explode('&', $string_parameters);
331 331
             foreach ($string_parameters_array as $s) {
332 332
                 $part = explode('=', $s);
333
-                if(isset($part[0]) && isset($part[1])) {
333
+                if (isset($part[0]) && isset($part[1])) {
334 334
                     $name = htmlspecialchars(urldecode($part[0]));
335 335
                     $name = strip_tags($name);
336 336
                     $value = htmlspecialchars(urldecode($part[1]));
@@ -347,16 +347,16 @@  discard block
 block discarded – undo
347 347
 
348 348
 
349 349
     public function routeGet($prefix, $controller) {
350
-        $alias = str_replace("@"," ", $controller);
350
+        $alias = str_replace("@", " ", $controller);
351 351
         $alias = ucwords($alias);
352
-        $alias = str_replace(" ","",$alias);
352
+        $alias = str_replace(" ", "", $alias);
353 353
         Route::get($prefix, ['uses' => $controller, 'as' => $alias]);
354 354
     }
355 355
 
356 356
     public function routePost($prefix, $controller) {
357
-        $alias = str_replace("@"," ", $controller);
357
+        $alias = str_replace("@", " ", $controller);
358 358
         $alias = ucwords($alias);
359
-        $alias = str_replace(" ","",$alias);
359
+        $alias = str_replace(" ", "", $alias);
360 360
         Route::post($prefix, ['uses' => $controller, 'as' => $alias]);
361 361
     }
362 362
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 
382 382
         $prefix = trim($prefix, '/').'/';
383 383
 
384
-        if(substr($controller,0,1) != "\\") {
384
+        if (substr($controller, 0, 1) != "\\") {
385 385
             $controller = "\App\Http\Controllers\\".$controller;
386 386
         }
387 387
 
Please login to merge, or discard this patch.
src/controllers/DeveloperMenusController.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -24,22 +24,22 @@  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 getAdd() {
31 31
         $data = [];
32 32
         $data['form_title'] = "Add Menu";
33 33
         $data['form_url'] = route('DeveloperMenusControllerPostAddSave');
34
-        $data['modules'] = DB::table("cb_modules")->orderBy("name","asc")->get();
34
+        $data['modules'] = DB::table("cb_modules")->orderBy("name", "asc")->get();
35 35
         return view($this->view.".form", $data);
36 36
     }
37 37
 
38 38
     public function getEdit($id) {
39 39
         $data = [];
40 40
         $data['form_title'] = "Edit Menu";
41
-        $data['form_url'] = route('DeveloperMenusControllerPostEditSave',['id'=>$id]);
42
-        $data['modules'] = DB::table("cb_modules")->orderBy("name","asc")->get();
41
+        $data['form_url'] = route('DeveloperMenusControllerPostEditSave', ['id'=>$id]);
42
+        $data['modules'] = DB::table("cb_modules")->orderBy("name", "asc")->get();
43 43
         $data['row'] = cb()->find("cb_menus", $id);
44 44
         return view($this->view.".form", $data);
45 45
     }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             $menu['name'] = request('name');
53 53
             $menu['icon'] = request('icon');
54 54
             $menu['type'] = request('type');
55
-            if(request('type') == 'module') {
55
+            if (request('type') == 'module') {
56 56
                 $menu['cb_modules_id'] = request('cb_modules_id');
57 57
             }elseif (request('type') == 'url') {
58 58
                 $menu['path'] = request('url_value');
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
             DB::table("cb_menus")->insert($menu);
64 64
 
65
-            return cb()->redirect(route("DeveloperMenusControllerGetIndex"),"The menu has been added!","success");
65
+            return cb()->redirect(route("DeveloperMenusControllerGetIndex"), "The menu has been added!", "success");
66 66
 
67 67
         } catch (CBValidationException $e) {
68 68
             return cb()->redirectBack($e->getMessage());
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
             $menu['name'] = request('name');
78 78
             $menu['icon'] = request('icon');
79 79
             $menu['type'] = request('type');
80
-            if(request('type') == 'module') {
80
+            if (request('type') == 'module') {
81 81
                 $menu['cb_modules_id'] = request('cb_modules_id');
82 82
             }elseif (request('type') == 'url') {
83 83
                 $menu['path'] = request('url_value');
84 84
             }elseif (request('type') == 'path') {
85 85
                 $menu['path'] = request('path_value');
86 86
             }
87
-            DB::table("cb_menus")->where("id",$id)->update($menu);
87
+            DB::table("cb_menus")->where("id", $id)->update($menu);
88 88
 
89
-            return cb()->redirect(route("DeveloperMenusControllerGetIndex"),"The menu has been saved!","success");
89
+            return cb()->redirect(route("DeveloperMenusControllerGetIndex"), "The menu has been saved!", "success");
90 90
 
91 91
         } catch (CBValidationException $e) {
92 92
             return cb()->redirectBack($e->getMessage());
@@ -99,20 +99,20 @@  discard block
 block discarded – undo
99 99
 
100 100
             $menus = request('menus');
101 101
             $menus = json_decode($menus, true);
102
-            if($menus) {
102
+            if ($menus) {
103 103
                 $menus = $menus[0];
104
-                if($menus) {
105
-                    foreach($menus as $i=>$menu) {
104
+                if ($menus) {
105
+                    foreach ($menus as $i=>$menu) {
106 106
                         $id = $menu['id'];
107
-                        cb()->update("cb_menus",$id,["sort_number"=>$i,'parent_cb_menus_id'=>null]);
108
-                        if($menu['children'][0]) {
109
-                            foreach($menu['children'][0] as $ii=>$sub) {
107
+                        cb()->update("cb_menus", $id, ["sort_number"=>$i, 'parent_cb_menus_id'=>null]);
108
+                        if ($menu['children'][0]) {
109
+                            foreach ($menu['children'][0] as $ii=>$sub) {
110 110
                                 $id = $sub['id'];
111
-                                cb()->update("cb_menus",$id,["sort_number"=>$ii,"parent_cb_menus_id"=>$menu['id']]);
112
-                                if($sub['children'][0]) {
113
-                                    foreach($sub['children'][0] as $iii=>$subsub) {
111
+                                cb()->update("cb_menus", $id, ["sort_number"=>$ii, "parent_cb_menus_id"=>$menu['id']]);
112
+                                if ($sub['children'][0]) {
113
+                                    foreach ($sub['children'][0] as $iii=>$subsub) {
114 114
                                         $id = $subsub['id'];
115
-                                        cb()->update("cb_menus",$id,["sort_number"=>$iii,"parent_cb_menus_id"=>$sub['id']]);
115
+                                        cb()->update("cb_menus", $id, ["sort_number"=>$iii, "parent_cb_menus_id"=>$sub['id']]);
116 116
                                     }
117 117
                                 }
118 118
                             }
@@ -121,17 +121,17 @@  discard block
 block discarded – undo
121 121
                 }
122 122
             }
123 123
 
124
-            return response()->json(['api_status'=>1,'api_message'=>'success']);
124
+            return response()->json(['api_status'=>1, 'api_message'=>'success']);
125 125
 
126 126
         } catch (CBValidationException $e) {
127
-            return response()->json(['api_status'=>0,'api_message'=>$e->getMessage()]);
127
+            return response()->json(['api_status'=>0, 'api_message'=>$e->getMessage()]);
128 128
         }
129 129
     }
130 130
 
131 131
     public function getDelete($id) {
132
-        DB::table("cb_menus")->where("id",$id)->delete();
132
+        DB::table("cb_menus")->where("id", $id)->delete();
133 133
 
134
-        return cb()->redirectBack("The menu has been deleted!","success");
134
+        return cb()->redirectBack("The menu has been deleted!", "success");
135 135
     }
136 136
 
137 137
 }
138 138
\ No newline at end of file
Please login to merge, or discard this patch.
src/types/select/SelectController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
         $foreignValue = request('foreign_value');
19 19
         $table = decrypt(request('table'));
20 20
         $sqlCondition = decrypt(request('sql_condition'));
21
-        if($foreignKey && $foreignValue && $table) {
21
+        if ($foreignKey && $foreignValue && $table) {
22 22
 
23 23
             $data = DB::table($table)
24 24
                 ->where($foreignKey, $foreignValue);
25
-            if($sqlCondition) {
25
+            if ($sqlCondition) {
26 26
                 $data->whereRaw($sqlCondition);
27 27
             }
28 28
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
             return response()->json(['status'=>true, 'data'=>$data], 200, ["X-Frame-Options"=>"SAMEORIGIN"]);
32 32
 
33
-        }else{
33
+        } else {
34 34
             return response()->json(['status'=>false]);
35 35
         }
36 36
     }
Please login to merge, or discard this patch.