@@ -25,15 +25,15 @@ |
||
25 | 25 | { |
26 | 26 | |
27 | 27 | try { |
28 | - if(@$this->command->option("password") == "AUTO" || !@$this->command->option("password")) { |
|
28 | + if (@$this->command->option("password") == "AUTO" || !@$this->command->option("password")) { |
|
29 | 29 | $password = Str::random(16); |
30 | - }else{ |
|
30 | + } else { |
|
31 | 31 | $password = $this->command->option("password"); |
32 | 32 | } |
33 | 33 | |
34 | - if(@$this->command->option("username") == "AUTO" || !@$this->command->option("username")) { |
|
34 | + if (@$this->command->option("username") == "AUTO" || !@$this->command->option("username")) { |
|
35 | 35 | $username = Str::random(5); |
36 | - }else{ |
|
36 | + } else { |
|
37 | 37 | $username = $this->command->option("username"); |
38 | 38 | } |
39 | 39 | } catch (\Exception $e) { |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | // Register views |
26 | 26 | $this->loadViewsFrom(__DIR__.'/views', 'crudbooster'); |
27 | 27 | $this->loadViewsFrom(__DIR__.'/types', 'types'); |
28 | - $this->loadTranslationsFrom(__DIR__."/localization","cb"); |
|
28 | + $this->loadTranslationsFrom(__DIR__."/localization", "cb"); |
|
29 | 29 | |
30 | 30 | // Publish the files |
31 | - $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')],'cb_config'); |
|
32 | - $this->publishes([__DIR__.'/database' => base_path('database')],'cb_migration'); |
|
33 | - $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')],'cb_hook'); |
|
34 | - $this->publishes([__DIR__ . '/assets' =>public_path('cb_asset')],'cb_asset'); |
|
31 | + $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')], 'cb_config'); |
|
32 | + $this->publishes([__DIR__.'/database' => base_path('database')], 'cb_migration'); |
|
33 | + $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')], 'cb_hook'); |
|
34 | + $this->publishes([__DIR__.'/assets' =>public_path('cb_asset')], 'cb_asset'); |
|
35 | 35 | |
36 | 36 | // Override Local FileSystem |
37 | 37 | Config::set("filesystems.disks.local.root", cbConfig("LOCAL_FILESYSTEM_PATH", public_path("storage"))); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | require __DIR__.'/helpers/Helper.php'; |
54 | 54 | |
55 | 55 | // Singletons |
56 | - $this->app->singleton('crudbooster', function () |
|
56 | + $this->app->singleton('crudbooster', function() |
|
57 | 57 | { |
58 | 58 | return true; |
59 | 59 | }); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | // Merging configuration |
74 | - $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php','crudbooster'); |
|
74 | + $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php', 'crudbooster'); |
|
75 | 75 | |
76 | 76 | // Register additional library |
77 | 77 | $this->app->register('Intervention\Image\ImageServiceProvider'); |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | private function registerPlugin() |
84 | 84 | { |
85 | 85 | $views = scandir(app_path("CBPlugins")); |
86 | - foreach($views as $view) { |
|
87 | - if($view != "." && $view != "..") { |
|
86 | + foreach ($views as $view) { |
|
87 | + if ($view != "." && $view != "..") { |
|
88 | 88 | $basename = basename($view); |
89 | 89 | // register view |
90 | - $this->loadViewsFrom(app_path("CBPlugins".DIRECTORY_SEPARATOR.$basename.DIRECTORY_SEPARATOR."Views"),$basename); |
|
90 | + $this->loadViewsFrom(app_path("CBPlugins".DIRECTORY_SEPARATOR.$basename.DIRECTORY_SEPARATOR."Views"), $basename); |
|
91 | 91 | // register route |
92 | 92 | require app_path("CBPlugins".DIRECTORY_SEPARATOR.$basename.DIRECTORY_SEPARATOR."Routes".DIRECTORY_SEPARATOR."Route.php"); |
93 | 93 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | private function registerTypeRoutes() { |
98 | 98 | $routes = rglob(__DIR__.DIRECTORY_SEPARATOR."types".DIRECTORY_SEPARATOR."Route.php"); |
99 | - foreach($routes as $route) { |
|
99 | + foreach ($routes as $route) { |
|
100 | 100 | require $route; |
101 | 101 | } |
102 | 102 | } |
@@ -15,26 +15,26 @@ discard block |
||
15 | 15 | |
16 | 16 | public static function has($key) |
17 | 17 | { |
18 | - if(file_exists(app_path("CBPlugins/".$key))) return true; |
|
18 | + if (file_exists(app_path("CBPlugins/".$key))) return true; |
|
19 | 19 | else return false; |
20 | 20 | } |
21 | 21 | |
22 | 22 | public static function isNeedUpgrade($pluginKey, $versionToCompare) |
23 | 23 | { |
24 | 24 | $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$pluginKey."/plugin.json")), true); |
25 | - if($pluginJson) { |
|
26 | - return version_compare($pluginJson['version'], $versionToCompare,"!="); |
|
27 | - }else{ |
|
25 | + if ($pluginJson) { |
|
26 | + return version_compare($pluginJson['version'], $versionToCompare, "!="); |
|
27 | + } else { |
|
28 | 28 | return false; |
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | 32 | public static function registerDefaultRoute($dir) |
33 | 33 | { |
34 | - Route::group(['middleware' => ['web',\crocodicstudio\crudbooster\middlewares\CBDeveloper::class], |
|
34 | + Route::group(['middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBDeveloper::class], |
|
35 | 35 | 'prefix'=>"developer/".getSetting('developer_path'), |
36 | - 'namespace' => 'App\CBPlugins\\'.basename(dirname("./../".$dir)).'\Controllers'], function () use ($dir) { |
|
37 | - cb()->routeController("plugins/".basename(dirname("./../".$dir)),"\App\CBPlugins\\".basename(dirname("./../".$dir))."\Controllers\\".basename(dirname("./../".$dir))."Controller"); |
|
36 | + 'namespace' => 'App\CBPlugins\\'.basename(dirname("./../".$dir)).'\Controllers'], function() use ($dir) { |
|
37 | + cb()->routeController("plugins/".basename(dirname("./../".$dir)), "\App\CBPlugins\\".basename(dirname("./../".$dir))."\Controllers\\".basename(dirname("./../".$dir))."Controller"); |
|
38 | 38 | }); |
39 | 39 | } |
40 | 40 | |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | $plugins = scandir(app_path("CBPlugins")); |
44 | 44 | |
45 | 45 | $result = []; |
46 | - foreach($plugins as $plugin) { |
|
47 | - if($plugin != "." && $plugin != "..") { |
|
46 | + foreach ($plugins as $plugin) { |
|
47 | + if ($plugin != "." && $plugin != "..") { |
|
48 | 48 | $basename = basename($plugin); |
49 | 49 | $row = json_decode(file_get_contents(app_path("CBPlugins".DIRECTORY_SEPARATOR.$plugin.DIRECTORY_SEPARATOR."plugin.json")), true); |
50 | - if($row) { |
|
50 | + if ($row) { |
|
51 | 51 | $result[] = [ |
52 | 52 | "name"=>$row['name'], |
53 | 53 | "version"=>$row['version'], |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | public function getIndex() { |
32 | 32 | $data = []; |
33 | 33 | $data['result'] = DB::table("cb_modules")->get(); |
34 | - return view($this->view.'.index',$data); |
|
34 | + return view($this->view.'.index', $data); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function getAdd() { |
38 | 38 | $data = []; |
39 | 39 | $data['tables'] = cb()->listAllTable(); |
40 | - $data['module'] = (request('modules_id'))?cb()->find("cb_modules", request("modules_id")):null; |
|
40 | + $data['module'] = (request('modules_id')) ?cb()->find("cb_modules", request("modules_id")) : null; |
|
41 | 41 | return view($this->view.'.add', $data); |
42 | 42 | } |
43 | 43 | |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | $data = cb()->listAllColumns($table); |
51 | 51 | $pk = cb()->findPrimaryKey($table); |
52 | 52 | $result = []; |
53 | - foreach($data as $item) { |
|
53 | + foreach ($data as $item) { |
|
54 | 54 | |
55 | - if(Str::contains(strtolower($item),["title","name","label"])) { |
|
55 | + if (Str::contains(strtolower($item), ["title", "name", "label"])) { |
|
56 | 56 | $display = true; |
57 | - }else{ |
|
57 | + } else { |
|
58 | 58 | $display = false; |
59 | 59 | } |
60 | 60 | |
61 | 61 | $result[] = [ |
62 | 62 | "column"=>$item, |
63 | - "primary_key"=>($pk==$item)?true:false, |
|
63 | + "primary_key"=>($pk == $item) ?true:false, |
|
64 | 64 | "display"=>$display |
65 | 65 | ]; |
66 | 66 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | |
70 | 70 | public function getColumns($table) |
71 | 71 | { |
72 | - if(request("modules_id")) { |
|
73 | - $module = cb()->find("cb_modules",request("modules_id")); |
|
74 | - if($module->last_column_build) { |
|
72 | + if (request("modules_id")) { |
|
73 | + $module = cb()->find("cb_modules", request("modules_id")); |
|
74 | + if ($module->last_column_build) { |
|
75 | 75 | return response()->json(json_decode($module->last_column_build)); |
76 | 76 | } |
77 | 77 | } |
@@ -79,56 +79,56 @@ discard block |
||
79 | 79 | $columns = cb()->listAllColumns($table); |
80 | 80 | $pk = cb()->findPrimaryKey($table); |
81 | 81 | $result = []; |
82 | - foreach($columns as $column) { |
|
83 | - if($column != $pk) { |
|
82 | + foreach ($columns as $column) { |
|
83 | + if ($column != $pk) { |
|
84 | 84 | |
85 | 85 | // Skip Column |
86 | - if($column == 'deleted_at') continue; |
|
86 | + if ($column == 'deleted_at') continue; |
|
87 | 87 | |
88 | 88 | // Check if any relation table candidate |
89 | 89 | $optionTable = ""; |
90 | - if(Str::substr(strtolower($column),-3,3) == "_id") { |
|
91 | - $relationTable = Str::substr($column,0,-3); |
|
92 | - if(Schema::hasTable($relationTable)) { |
|
90 | + if (Str::substr(strtolower($column), -3, 3) == "_id") { |
|
91 | + $relationTable = Str::substr($column, 0, -3); |
|
92 | + if (Schema::hasTable($relationTable)) { |
|
93 | 93 | $optionTable = $relationTable; |
94 | 94 | } |
95 | - }elseif (Str::substr(strtolower($column),0,3) == "id_") { |
|
96 | - $relationTable = Str::substr($column,3); |
|
97 | - if(Schema::hasTable($relationTable)) { |
|
95 | + }elseif (Str::substr(strtolower($column), 0, 3) == "id_") { |
|
96 | + $relationTable = Str::substr($column, 3); |
|
97 | + if (Schema::hasTable($relationTable)) { |
|
98 | 98 | $optionTable = $relationTable; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - $label = trim(Str::title(str_replace(["id_","_id","_"]," ",$column))); |
|
102 | + $label = trim(Str::title(str_replace(["id_", "_id", "_"], " ", $column))); |
|
103 | 103 | $label = Str::singular($label); |
104 | 104 | $type = "text"; |
105 | 105 | |
106 | - if(Str::contains(strtolower($label),["photo","image","picture","gambar"])) { |
|
106 | + if (Str::contains(strtolower($label), ["photo", "image", "picture", "gambar"])) { |
|
107 | 107 | $type = "image"; |
108 | - }elseif (Str::contains(strtolower($label),["email","mail"])) { |
|
108 | + }elseif (Str::contains(strtolower($label), ["email", "mail"])) { |
|
109 | 109 | $type = "email"; |
110 | - }elseif (Str::contains(strtolower($label),["description","content","detail"])) { |
|
111 | - $type = "wysiwyg"; |
|
112 | - }elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) { |
|
110 | + }elseif (Str::contains(strtolower($label), ["description", "content", "detail"])) { |
|
111 | + $type = "wysiwyg"; |
|
112 | + }elseif (Str::contains(strtolower($label), ["price", "money", "grand_total", "tax"])) { |
|
113 | 113 | $type = "money"; |
114 | - }elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) { |
|
114 | + }elseif (Str::contains(strtolower($label), ["quantity", "qty", "total", "phone", "telp"])) { |
|
115 | 115 | $type = "number"; |
116 | - }elseif (Str::contains(strtolower($label),["date"])) { |
|
116 | + }elseif (Str::contains(strtolower($label), ["date"])) { |
|
117 | 117 | $type = "date"; |
118 | 118 | } |
119 | 119 | |
120 | - if (Str::substr(strtolower($column),-3,3) == "_id") { |
|
120 | + if (Str::substr(strtolower($column), -3, 3) == "_id") { |
|
121 | 121 | $type = "select_table"; |
122 | 122 | } elseif (Str::substr($column, -3, 3) == "_at") { |
123 | 123 | $type = "datetime"; |
124 | - } elseif (Str::substr($column,0, 3) == "id_") { |
|
124 | + } elseif (Str::substr($column, 0, 3) == "id_") { |
|
125 | 125 | $type = "select_table"; |
126 | 126 | } |
127 | 127 | |
128 | 128 | $columnAdd = "on"; |
129 | 129 | $columnEdit = "on"; |
130 | 130 | $columnMandatory = "on"; |
131 | - if(in_array($column,['created_at','updated_at'])) { |
|
131 | + if (in_array($column, ['created_at', 'updated_at'])) { |
|
132 | 132 | $columnAdd = ""; |
133 | 133 | $columnEdit = ""; |
134 | 134 | $columnMandatory = ""; |
@@ -187,39 +187,39 @@ discard block |
||
187 | 187 | public function postCreateMigration() |
188 | 188 | { |
189 | 189 | try { |
190 | - cb()->validation(['table_name','structures']); |
|
190 | + cb()->validation(['table_name', 'structures']); |
|
191 | 191 | |
192 | 192 | $tableName = request("table_name"); |
193 | 193 | |
194 | - if(!Schema::hasTable($tableName)) { |
|
194 | + if (!Schema::hasTable($tableName)) { |
|
195 | 195 | $filenameMigration = date("Y_m_d_His")."_".$tableName.".php"; |
196 | 196 | $createTemplate = file_get_contents(base_path("vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/create.stub")); |
197 | 197 | $className = Str::studly($tableName); |
198 | 198 | $createTemplate = str_replace("DummyClass", $className, $createTemplate); |
199 | 199 | $createTemplate = str_replace("DummyTable", $tableName, $createTemplate); |
200 | - $createTemplate = str_replace("\$table->increments('id');","",$createTemplate); |
|
200 | + $createTemplate = str_replace("\$table->increments('id');", "", $createTemplate); |
|
201 | 201 | |
202 | 202 | $structureItems = ""; |
203 | 203 | |
204 | - if(request("timestamp")) { |
|
204 | + if (request("timestamp")) { |
|
205 | 205 | $structureItems .= "\$table->timestamps();\n\t\t\t"; |
206 | 206 | } |
207 | 207 | |
208 | - if(request("soft_deletes")) { |
|
208 | + if (request("soft_deletes")) { |
|
209 | 209 | $structureItems .= "\$table->softDeletes();\n\t\t\t"; |
210 | 210 | } |
211 | 211 | |
212 | - foreach(request("structures") as $item) { |
|
212 | + foreach (request("structures") as $item) { |
|
213 | 213 | |
214 | 214 | $nullable = ""; |
215 | 215 | |
216 | - if(!in_array($item['type_data'],["bigIncrements","increments","mediumIncrements","smallIncrements"])) { |
|
216 | + if (!in_array($item['type_data'], ["bigIncrements", "increments", "mediumIncrements", "smallIncrements"])) { |
|
217 | 217 | $nullable = "->nullable()"; |
218 | 218 | } |
219 | 219 | |
220 | - if($item['length']) { |
|
220 | + if ($item['length']) { |
|
221 | 221 | $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."', ".$item['length'].")$nullable;\n\t\t\t"; |
222 | - }else{ |
|
222 | + } else { |
|
223 | 223 | $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."')$nullable;\n\t\t\t"; |
224 | 224 | } |
225 | 225 | } |
@@ -238,12 +238,12 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | } catch (CBValidationException $e) { |
241 | - return response()->json(['status'=>false,'message'=>$e->getMessage()]); |
|
241 | + return response()->json(['status'=>false, 'message'=>$e->getMessage()]); |
|
242 | 242 | } catch (\Exception $e) { |
243 | - return response()->json(['status'=>false,'message'=>$e->getMessage()]); |
|
243 | + return response()->json(['status'=>false, 'message'=>$e->getMessage()]); |
|
244 | 244 | } |
245 | 245 | |
246 | - return response()->json(['status'=>true,'message'=>'Migration successfully!']); |
|
246 | + return response()->json(['status'=>true, 'message'=>'Migration successfully!']); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | public function postCheckExistModule() |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | try { |
252 | 252 | cb()->validation(['name', 'table']); |
253 | 253 | |
254 | - if(DB::table("cb_modules")->where("table_name",request("table"))->where("name",request("name"))->count()) { |
|
254 | + if (DB::table("cb_modules")->where("table_name", request("table"))->where("name", request("name"))->count()) { |
|
255 | 255 | return response()->json(['status'=>true]); |
256 | 256 | } |
257 | 257 | |
258 | 258 | } catch (CBValidationException $e) { |
259 | - return response()->json(['status'=>false,'message'=>$e->getMessage()]); |
|
259 | + return response()->json(['status'=>false, 'message'=>$e->getMessage()]); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | return response()->json(['status'=>false]); |
@@ -265,30 +265,30 @@ discard block |
||
265 | 265 | public function postAddSave() { |
266 | 266 | |
267 | 267 | try { |
268 | - cb()->validation(['name', 'table','icon','columns']); |
|
268 | + cb()->validation(['name', 'table', 'icon', 'columns']); |
|
269 | 269 | |
270 | 270 | $module = (new ModuleGenerator(request('table'), request('name'), request('icon'), request("columns"), request("rebuild")))->make(); |
271 | 271 | |
272 | 272 | } catch (CBValidationException $e) { |
273 | - return response()->json(['status'=>false,'message'=>$e->getMessage()]); |
|
273 | + return response()->json(['status'=>false, 'message'=>$e->getMessage()]); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | return response()->json(['status'=>true, 'message'=>'Please remember that you can still modify the structure by edit the controller file '.$module['controller'].' :)']); |
277 | 277 | } |
278 | 278 | |
279 | 279 | public function getDelete($id) { |
280 | - $module = cb()->find("cb_modules",$id); |
|
280 | + $module = cb()->find("cb_modules", $id); |
|
281 | 281 | @unlink(app_path("Http/Controllers/".$module->controller.".php")); |
282 | 282 | DB::table("cb_modules")->where("id", $id)->delete(); |
283 | 283 | DB::table("cb_menus")->where("cb_modules_id", $id)->delete(); |
284 | - return cb()->redirectBack("The module has been deleted!","success"); |
|
284 | + return cb()->redirectBack("The module has been deleted!", "success"); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | public function getDeleteSoft($id) { |
288 | - $module = cb()->find("cb_modules",$id); |
|
288 | + $module = cb()->find("cb_modules", $id); |
|
289 | 289 | DB::table("cb_modules")->where("id", $id)->delete(); |
290 | 290 | DB::table("cb_menus")->where("cb_modules_id", $id)->delete(); |
291 | - return cb()->redirectBack("The module has been deleted!","success"); |
|
291 | + return cb()->redirectBack("The module has been deleted!", "success"); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | } |
295 | 295 | \ No newline at end of file |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function getIndex() { |
19 | 19 | $data = []; |
20 | 20 | $data['page_title'] = "Dashboard"; |
21 | - return view('crudbooster::dev_layouts.modules.dashboard',$data); |
|
21 | + return view('crudbooster::dev_layouts.modules.dashboard', $data); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function postSkipTutorial() |
@@ -24,7 +24,7 @@ discard block |
||
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() |
@@ -38,6 +38,6 @@ discard block |
||
38 | 38 | "MAIL_ENCRYPTION"=>request("MAIL_ENCRYPTION") |
39 | 39 | ]); |
40 | 40 | |
41 | - return cb()->redirectBack("Mail configuration has been updated!","success"); |
|
41 | + return cb()->redirectBack("Mail configuration has been updated!", "success"); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -11,11 +11,11 @@ discard block |
||
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 |
||
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 | } |
@@ -19,25 +19,25 @@ |
||
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 |
@@ -28,14 +28,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |