@@ -18,11 +18,11 @@ discard block |
||
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 |
||
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 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | name="{{ $column->getName() }}" id="{{ $column->getName() }}"> |
8 | 8 | <option value="">** Select a {{ $column->getLabel() }}</option> |
9 | 9 | <?php |
10 | - $columnValue = old($column->getName())?:($column->getDefaultValue())?:$column->getValue(); |
|
10 | + $columnValue = old($column->getName()) ?: ($column->getDefaultValue()) ?: $column->getValue(); |
|
11 | 11 | ?> |
12 | 12 | @foreach($column->getOptions() as $key=>$value) |
13 | 13 | <option {{ $columnValue==$key?'selected':'' }} value="{{ $key }}">{{ $value }}</option> |
@@ -29,16 +29,16 @@ |
||
29 | 29 | |
30 | 30 | columnSingleton()->setColumn($this->index, $data); |
31 | 31 | |
32 | - if(is_callable($query)) { |
|
32 | + if (is_callable($query)) { |
|
33 | 33 | $result = call_user_func($query); |
34 | - }else{ |
|
34 | + } else { |
|
35 | 35 | $result = DB::select(DB::raw($query)); |
36 | 36 | } |
37 | 37 | |
38 | - if($result) { |
|
38 | + if ($result) { |
|
39 | 39 | $options = []; |
40 | - foreach($result as $r) { |
|
41 | - $options[ $r->key ] = $r->label; |
|
40 | + foreach ($result as $r) { |
|
41 | + $options[$r->key] = $r->label; |
|
42 | 42 | } |
43 | 43 | $this->options($options); |
44 | 44 | } |
@@ -18,8 +18,8 @@ |
||
18 | 18 | */ |
19 | 19 | public function handle($request, Closure $next) |
20 | 20 | { |
21 | - if(auth()->guest()) { |
|
22 | - return cb()->redirect(cb()->getLoginUrl("login"),trans('cb::cb.please_login_for_first'),'warning'); |
|
21 | + if (auth()->guest()) { |
|
22 | + return cb()->redirect(cb()->getLoginUrl("login"), trans('cb::cb.please_login_for_first'), 'warning'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | (new CBHook())->beforeBackendMiddleware($request); |
@@ -1,39 +1,39 @@ discard block |
||
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()->routeGet("/","DeveloperDashboardController@getIndex"); |
|
9 | + cb()->routeController("roles", "\crocodicstudio\crudbooster\controllers\DeveloperRolesController"); |
|
10 | + cb()->routeController("users", "\crocodicstudio\crudbooster\controllers\DeveloperUsersController"); |
|
11 | + cb()->routeGet("/", "DeveloperDashboardController@getIndex"); |
|
12 | 12 | }); |
13 | 13 | |
14 | 14 | // Developer Auth Middleware |
15 | 15 | Route::group(['middleware' => ['web'], |
16 | 16 | 'prefix'=>"developer/".getSetting('developer_path'), |
17 | - 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () { |
|
18 | - cb()->routePost("login","AdminAuthController@postLoginDeveloper"); |
|
19 | - cb()->routeGet("login","AdminAuthController@getLoginDeveloper"); |
|
20 | - cb()->routeGet("logout","AdminAuthController@getLogoutDeveloper"); |
|
17 | + 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() { |
|
18 | + cb()->routePost("login", "AdminAuthController@postLoginDeveloper"); |
|
19 | + cb()->routeGet("login", "AdminAuthController@getLoginDeveloper"); |
|
20 | + cb()->routeGet("logout", "AdminAuthController@getLogoutDeveloper"); |
|
21 | 21 | }); |
22 | 22 | |
23 | 23 | // Routing without any middleware |
24 | -Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function () { |
|
24 | +Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function() { |
|
25 | 25 | cb()->routeGet('uploads/{one?}/{two?}/{three?}/{four?}/{five?}', "FileController@getPreview"); |
26 | 26 | }); |
27 | 27 | |
28 | 28 | // Routing without any middleware with admin prefix |
29 | -Route::group(['middleware' => ['web'], 'prefix' => cbConfig('ADMIN_PATH'), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () { |
|
29 | +Route::group(['middleware' => ['web'], 'prefix' => cbConfig('ADMIN_PATH'), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() { |
|
30 | 30 | cb()->routeGet('logout', "AdminAuthController@getLogout"); |
31 | 31 | cb()->routePost('login', "AdminAuthController@postLogin"); |
32 | 32 | cb()->routeGet('login', "AdminAuthController@getLogin"); |
33 | 33 | }); |
34 | 34 | |
35 | 35 | // Routing package controllers |
36 | -cb()->routeGroupBackend(function () { |
|
36 | +cb()->routeGroupBackend(function() { |
|
37 | 37 | cb()->routeController('profile', '\crocodicstudio\crudbooster\controllers\AdminProfileController'); |
38 | 38 | }); |
39 | 39 | |
@@ -42,24 +42,24 @@ discard block |
||
42 | 42 | 'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBBackend::class], |
43 | 43 | 'prefix' => cbConfig('ADMIN_PATH'), |
44 | 44 | 'namespace' => 'App\Http\Controllers', |
45 | -], function () { |
|
45 | +], function() { |
|
46 | 46 | |
47 | 47 | if (Request::is(cbConfig('ADMIN_PATH'))) { |
48 | - if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) { |
|
48 | + if ($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) { |
|
49 | 49 | cb()->routeGet("/", $dashboard); |
50 | - }else{ |
|
50 | + } else { |
|
51 | 51 | cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex"); |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | 55 | $controllers = glob(app_path('Http/Controllers/Admin*Controller.php')); |
56 | 56 | |
57 | - foreach($controllers as $controller) { |
|
57 | + foreach ($controllers as $controller) { |
|
58 | 58 | $controllerName = basename($controller); |
59 | - $controllerName = rtrim($controllerName,".php"); |
|
59 | + $controllerName = rtrim($controllerName, ".php"); |
|
60 | 60 | $className = '\App\Http\Controllers\\'.$controllerName; |
61 | 61 | $controllerClass = new $className(); |
62 | - if(method_exists($controllerClass, 'cbInit')) { |
|
62 | + if (method_exists($controllerClass, 'cbInit')) { |
|
63 | 63 | cb()->routeController($controllerClass->getData('permalink'), $controllerName); |
64 | 64 | } |
65 | 65 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | if ($this->confirm('Do you have setting the database configuration at .env ?')) { |
41 | 41 | |
42 | - if (! file_exists(public_path('vendor')) ) { |
|
42 | + if (!file_exists(public_path('vendor'))) { |
|
43 | 43 | mkdir(public_path('vendor')); |
44 | 44 | } |
45 | 45 | |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | * We need it to change default laravel local filesystem from storage to public |
55 | 55 | * We won't use symlink because of a security issue in many server |
56 | 56 | */ |
57 | - if(!file_exists(public_path("storage"))) { |
|
57 | + if (!file_exists(public_path("storage"))) { |
|
58 | 58 | $this->info("Create storage directory on /public"); |
59 | 59 | mkdir(public_path("storage")); |
60 | - file_put_contents(public_path("storage/.gitignore"),"!.gitignore"); |
|
61 | - file_put_contents(public_path("storage/index.html")," "); |
|
60 | + file_put_contents(public_path("storage/.gitignore"), "!.gitignore"); |
|
61 | + file_put_contents(public_path("storage/index.html"), " "); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /* |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | * Disable php execution on /vendor/* |
68 | 68 | */ |
69 | 69 | $this->info("Tweak some security for your laravel"); |
70 | - file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND); |
|
71 | - file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND); |
|
70 | + file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND); |
|
71 | + file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND); |
|
72 | 72 | |
73 | 73 | |
74 | 74 | $this->info('Dumping the autoloaded files and reloading all new files...'); |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | $option = $column->getOptions(); |
23 | 23 | $key = $row->{ $column->getField() }; |
24 | - return @$option[ $key ]; |
|
24 | + return @$option[$key]; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function detailRender($row, $column) |
@@ -14,21 +14,21 @@ |
||
14 | 14 | { |
15 | 15 | public function postUploadFile() |
16 | 16 | { |
17 | - if(auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
17 | + if (auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
18 | 18 | |
19 | 19 | $file = null; |
20 | 20 | try { |
21 | 21 | |
22 | 22 | cb()->validation([ |
23 | - 'userfile' => 'required|mimes:' . implode(",",config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED')) |
|
23 | + 'userfile' => 'required|mimes:'.implode(",", config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED')) |
|
24 | 24 | ]); |
25 | 25 | |
26 | 26 | $file = cb()->uploadFile('userfile', request("encrypt")); |
27 | 27 | |
28 | 28 | } catch (CBValidationException $e) { |
29 | - return response()->json(['status'=>false,'message'=>$e->getMessage()]); |
|
29 | + return response()->json(['status'=>false, 'message'=>$e->getMessage()]); |
|
30 | 30 | } catch (\Exception $e) { |
31 | - return response()->json(['status'=>false,'message'=>$e->getMessage()]); |
|
31 | + return response()->json(['status'=>false, 'message'=>$e->getMessage()]); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | return response()->json([ |
@@ -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,12 +265,12 @@ 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'].' :)']); |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | try { |
287 | 287 | cb()->validation(['name', 'icon']); |
288 | 288 | |
289 | - cb()->updateCompact("cb_modules", $id, ['name','icon']); |
|
289 | + cb()->updateCompact("cb_modules", $id, ['name', 'icon']); |
|
290 | 290 | |
291 | - return cb()->redirect(route("DeveloperModulesControllerGetIndex"),"Module has been updated!","success"); |
|
291 | + return cb()->redirect(route("DeveloperModulesControllerGetIndex"), "Module has been updated!", "success"); |
|
292 | 292 | |
293 | 293 | } catch (CBValidationException $e) { |
294 | 294 | return cb()->redirectBack($e->getMessage()); |
@@ -296,18 +296,18 @@ discard block |
||
296 | 296 | } |
297 | 297 | |
298 | 298 | public function getDelete($id) { |
299 | - $module = cb()->find("cb_modules",$id); |
|
299 | + $module = cb()->find("cb_modules", $id); |
|
300 | 300 | @unlink(app_path("Http/Controllers/".$module->controller.".php")); |
301 | 301 | DB::table("cb_modules")->where("id", $id)->delete(); |
302 | 302 | DB::table("cb_menus")->where("cb_modules_id", $id)->delete(); |
303 | - return cb()->redirectBack("The module has been deleted!","success"); |
|
303 | + return cb()->redirectBack("The module has been deleted!", "success"); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | public function getDeleteSoft($id) { |
307 | - $module = cb()->find("cb_modules",$id); |
|
307 | + $module = cb()->find("cb_modules", $id); |
|
308 | 308 | DB::table("cb_modules")->where("id", $id)->delete(); |
309 | 309 | DB::table("cb_menus")->where("cb_modules_id", $id)->delete(); |
310 | - return cb()->redirectBack("The module has been deleted!","success"); |
|
310 | + return cb()->redirectBack("The module has been deleted!", "success"); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | } |
314 | 314 | \ No newline at end of file |