@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | public function make() { |
40 | - $name = trim(($this->name)?:ucwords(str_replace("_"," ",$this->table))); |
|
40 | + $name = trim(($this->name) ?: ucwords(str_replace("_", " ", $this->table))); |
|
41 | 41 | |
42 | 42 | $template = file_get_contents(__DIR__."/../templates/FooBarController.stub"); |
43 | 43 | |
44 | 44 | //Replace table |
45 | - $template = str_replace("{table}",'"'.$this->table.'"', $template); |
|
45 | + $template = str_replace("{table}", '"'.$this->table.'"', $template); |
|
46 | 46 | |
47 | 47 | //Replace permalink |
48 | - $permalink = strtolower(Str::slug($name,"_")); |
|
48 | + $permalink = strtolower(Str::slug($name, "_")); |
|
49 | 49 | $template = str_replace("{permalink}", '"'.$permalink.'"', $template); |
50 | 50 | |
51 | 51 | //Replace Page title |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | |
54 | 54 | //Replace scaffolding |
55 | 55 | $scaffold = ""; |
56 | - foreach($this->columns as $field) { |
|
56 | + foreach ($this->columns as $field) { |
|
57 | 57 | $label = $field['column_label']; |
58 | 58 | $column = $field['column_field']; |
59 | - $help = isset($field['column_help'])?"->help(\"".$field['column_help']."\")":""; |
|
60 | - $required = ($field['column_mandatory']=="on")?"":"->required(false)"; |
|
61 | - $indexShow = ($field['column_browse']=="on")?"":"->showIndex(false)"; |
|
62 | - $detailShow = ($field['column_detail']=="on")?"":"->showDetail(false)"; |
|
63 | - $editShow = ($field['column_edit']=="on")?"":"->showEdit(false)"; |
|
64 | - $addShow = ($field['column_add']=="on")?"":"->showAdd(false)"; |
|
59 | + $help = isset($field['column_help']) ? "->help(\"".$field['column_help']."\")" : ""; |
|
60 | + $required = ($field['column_mandatory'] == "on") ? "" : "->required(false)"; |
|
61 | + $indexShow = ($field['column_browse'] == "on") ? "" : "->showIndex(false)"; |
|
62 | + $detailShow = ($field['column_detail'] == "on") ? "" : "->showDetail(false)"; |
|
63 | + $editShow = ($field['column_edit'] == "on") ? "" : "->showEdit(false)"; |
|
64 | + $addShow = ($field['column_add'] == "on") ? "" : "->showAdd(false)"; |
|
65 | 65 | $optionTable = $field['column_option_table']; |
66 | 66 | $optionValue = $field['column_option_value']; |
67 | 67 | $optionDisplay = $field['column_option_display']; |
68 | 68 | $optionSqlCondition = $field['column_option_sql_condition']; |
69 | - $optionSqlCondition = str_replace('"',"'", $optionSqlCondition); |
|
69 | + $optionSqlCondition = str_replace('"', "'", $optionSqlCondition); |
|
70 | 70 | $sqlRawQuery = $field['column_sql_query']; |
71 | 71 | $options = $field['column_options']; |
72 | 72 | $imageResizeWidth = $field['column_image_width']; |
@@ -82,45 +82,45 @@ discard block |
||
82 | 82 | $moneyDecimalSeparator = $field['column_money_decimal_separator']; |
83 | 83 | |
84 | 84 | // Additional Attributes |
85 | - $additional = $required . $indexShow . $detailShow . $addShow . $editShow . $help ; |
|
85 | + $additional = $required.$indexShow.$detailShow.$addShow.$editShow.$help; |
|
86 | 86 | |
87 | 87 | // Additional money |
88 | - $additional .= ($moneyPrefix && $field['column_type']=='money')?"->prefix('".$moneyPrefix."')":""; |
|
89 | - $additional .= ($moneyPrecision && $field['column_type']=='money')?"->precision('".$moneyPrecision."')":""; |
|
90 | - $additional .= ($moneyThousandSeparator && $field['column_type']=='money')?"->thousandSeparator('".$moneyThousandSeparator."')":""; |
|
91 | - $additional .= ($moneyDecimalSeparator && $field['column_type']=='money')?"->decimalSeparator('".$moneyDecimalSeparator."')":""; |
|
88 | + $additional .= ($moneyPrefix && $field['column_type'] == 'money') ? "->prefix('".$moneyPrefix."')" : ""; |
|
89 | + $additional .= ($moneyPrecision && $field['column_type'] == 'money') ? "->precision('".$moneyPrecision."')" : ""; |
|
90 | + $additional .= ($moneyThousandSeparator && $field['column_type'] == 'money') ? "->thousandSeparator('".$moneyThousandSeparator."')" : ""; |
|
91 | + $additional .= ($moneyDecimalSeparator && $field['column_type'] == 'money') ? "->decimalSeparator('".$moneyDecimalSeparator."')" : ""; |
|
92 | 92 | |
93 | 93 | // Additional for image & file type |
94 | - $additional .= ($fileEncrypt && in_array($field['column_type'],['file','image']))?"->encrypt(true)":""; |
|
95 | - $additional .= ($imageResizeWidth && in_array($field['column_type'],['file','image']))?"->resize(".$imageResizeWidth.",".$imageResizeHeight.")":""; |
|
94 | + $additional .= ($fileEncrypt && in_array($field['column_type'], ['file', 'image'])) ? "->encrypt(true)" : ""; |
|
95 | + $additional .= ($imageResizeWidth && in_array($field['column_type'], ['file', 'image'])) ? "->resize(".$imageResizeWidth.",".$imageResizeHeight.")" : ""; |
|
96 | 96 | |
97 | 97 | // Additional for date & datetime |
98 | - $additional .= ($dateFormat && in_array($field['column_type'],['date','datetime']))?"->format('".$dateFormat."')":""; |
|
98 | + $additional .= ($dateFormat && in_array($field['column_type'], ['date', 'datetime'])) ? "->format('".$dateFormat."')" : ""; |
|
99 | 99 | |
100 | 100 | // Additional for text |
101 | - $additional .= ($textDisplayLimit!="" && in_array($field['column_type'],['text','text_area','wysiwyg']))?"->strLimit(".$textDisplayLimit.")":""; |
|
102 | - $additional .= ($maxCharacter!="" && in_array($field['column_type'],['text','text_area']))?"->maxLength(".$maxCharacter.")":""; |
|
103 | - $additional .= ($minCharacter!="" && in_array($field['column_type'],['text','text_area']))?"->minLength(".$minCharacter.")":""; |
|
101 | + $additional .= ($textDisplayLimit != "" && in_array($field['column_type'], ['text', 'text_area', 'wysiwyg'])) ? "->strLimit(".$textDisplayLimit.")" : ""; |
|
102 | + $additional .= ($maxCharacter != "" && in_array($field['column_type'], ['text', 'text_area'])) ? "->maxLength(".$maxCharacter.")" : ""; |
|
103 | + $additional .= ($minCharacter != "" && in_array($field['column_type'], ['text', 'text_area'])) ? "->minLength(".$minCharacter.")" : ""; |
|
104 | 104 | |
105 | 105 | $methodName = Str::studly($field['column_type']); |
106 | - if($label && $column) { |
|
107 | - if(in_array($field['column_type'],['radio','select_option','checkbox'])) { |
|
108 | - if($options) { |
|
106 | + if ($label && $column) { |
|
107 | + if (in_array($field['column_type'], ['radio', 'select_option', 'checkbox'])) { |
|
108 | + if ($options) { |
|
109 | 109 | $optResult = []; |
110 | - foreach($options as $opt) { |
|
110 | + foreach ($options as $opt) { |
|
111 | 111 | $optResult[$opt['key']] = $opt['label']; |
112 | 112 | } |
113 | - $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '")->options('.min_var_export($optResult).')' . $additional . ';' . "\n\t\t"; |
|
113 | + $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")->options('.min_var_export($optResult).')'.$additional.';'."\n\t\t"; |
|
114 | 114 | } |
115 | - }elseif (in_array($field['column_type'],['radio_table','select_table'])) { |
|
115 | + }elseif (in_array($field['column_type'], ['radio_table', 'select_table'])) { |
|
116 | 116 | if ($optionTable && $optionValue && $optionDisplay) { |
117 | - $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '",["table"=>"' . $optionTable . '","value_option"=>"' . $optionValue . '","display_option"=>"' . $optionDisplay . '","sql_condition"=>"' . $optionSqlCondition . '"])' . $additional . ';' . "\n\t\t"; |
|
117 | + $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'",["table"=>"'.$optionTable.'","value_option"=>"'.$optionValue.'","display_option"=>"'.$optionDisplay.'","sql_condition"=>"'.$optionSqlCondition.'"])'.$additional.';'."\n\t\t"; |
|
118 | 118 | } |
119 | 119 | }elseif ($field['column_type'] == "select_query") { |
120 | - if($sqlRawQuery && Str::contains($sqlRawQuery,["as `key`","as `label`"])) { |
|
121 | - $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '","'.$sqlRawQuery.'")' . $additional . ';' . "\n\t\t"; |
|
120 | + if ($sqlRawQuery && Str::contains($sqlRawQuery, ["as `key`", "as `label`"])) { |
|
121 | + $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'","'.$sqlRawQuery.'")'.$additional.';'."\n\t\t"; |
|
122 | 122 | } |
123 | - }else{ |
|
123 | + } else { |
|
124 | 124 | $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")'.$additional.';'."\n\t\t"; |
125 | 125 | } |
126 | 126 | } |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | $module['controller'] = $filename; |
144 | 144 | $module['last_column_build'] = json_encode($this->columns); |
145 | 145 | |
146 | - if($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name",$this->table)->first()) { |
|
147 | - DB::table("cb_modules")->where("id",$moduleData->id)->update($module); |
|
146 | + if ($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name", $this->table)->first()) { |
|
147 | + DB::table("cb_modules")->where("id", $moduleData->id)->update($module); |
|
148 | 148 | $id_modules = $moduleData->id; |
149 | - }else{ |
|
149 | + } else { |
|
150 | 150 | $id_modules = DB::table('cb_modules')->insertGetId($module); |
151 | 151 | } |
152 | 152 | |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | $menu['name'] = $module['name']; |
156 | 156 | $menu['type'] = 'module'; |
157 | 157 | $menu['cb_modules_id'] = $id_modules; |
158 | - if(isset($moduleData)) { |
|
159 | - DB::table("cb_menus")->where("cb_modules_id",$moduleData->id)->update($menu); |
|
160 | - }else{ |
|
158 | + if (isset($moduleData)) { |
|
159 | + DB::table("cb_menus")->where("cb_modules_id", $moduleData->id)->update($menu); |
|
160 | + } else { |
|
161 | 161 | DB::table('cb_menus')->insertGetId($menu); |
162 | 162 | } |
163 | 163 |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | } |
113 | 113 | $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '")->options('.min_var_export($optResult).')' . $additional . ';' . "\n\t\t"; |
114 | 114 | } |
115 | - }elseif (in_array($field['column_type'],['radio_table','select_table'])) { |
|
115 | + } elseif (in_array($field['column_type'],['radio_table','select_table'])) { |
|
116 | 116 | if ($optionTable && $optionValue && $optionDisplay) { |
117 | 117 | $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '",["table"=>"' . $optionTable . '","value_option"=>"' . $optionValue . '","display_option"=>"' . $optionDisplay . '","sql_condition"=>"' . $optionSqlCondition . '"])' . $additional . ';' . "\n\t\t"; |
118 | 118 | } |
119 | - }elseif ($field['column_type'] == "select_query") { |
|
119 | + } elseif ($field['column_type'] == "select_query") { |
|
120 | 120 | if($sqlRawQuery && Str::contains($sqlRawQuery,["as `key`","as `label`"])) { |
121 | 121 | $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '","'.$sqlRawQuery.'")' . $additional . ';' . "\n\t\t"; |
122 | 122 | } |
123 | - }else{ |
|
123 | + } else{ |
|
124 | 124 | $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")'.$additional.';'."\n\t\t"; |
125 | 125 | } |
126 | 126 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | if($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name",$this->table)->first()) { |
147 | 147 | DB::table("cb_modules")->where("id",$moduleData->id)->update($module); |
148 | 148 | $id_modules = $moduleData->id; |
149 | - }else{ |
|
149 | + } else{ |
|
150 | 150 | $id_modules = DB::table('cb_modules')->insertGetId($module); |
151 | 151 | } |
152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $menu['cb_modules_id'] = $id_modules; |
158 | 158 | if(isset($moduleData)) { |
159 | 159 | DB::table("cb_menus")->where("cb_modules_id",$moduleData->id)->update($menu); |
160 | - }else{ |
|
160 | + } else{ |
|
161 | 161 | DB::table('cb_menus')->insertGetId($menu); |
162 | 162 | } |
163 | 163 |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | /* |
32 | 32 | * For security reason we have limit the upload file formats bellow |
33 | 33 | */ |
34 | - 'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif','pdf','xls','xlsx','doc','docx','txt','zip','rar','rtf'], |
|
34 | + 'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif', 'pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt', 'zip', 'rar', 'rtf'], |
|
35 | 35 | |
36 | - 'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif'], |
|
36 | + 'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif'], |
|
37 | 37 | |
38 | 38 | /* |
39 | 39 | * Override Local FileSystem From Storage To Another |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * You can define in this array what the tables you want to include in "php artisan crudbooster:data_migration" |
70 | 70 | * The default is all cb_ prefix will be include in data migration |
71 | 71 | */ |
72 | - 'ADDITIONAL_DATA_MIGRATION'=>['users','migrations'], |
|
72 | + 'ADDITIONAL_DATA_MIGRATION'=>['users', 'migrations'], |
|
73 | 73 | |
74 | 74 | |
75 | 75 | /* |
@@ -18,8 +18,8 @@ |
||
18 | 18 | public function handle($request, Closure $next) |
19 | 19 | { |
20 | 20 | |
21 | - if(session()->get("developer") != getSetting('developer_username')) { |
|
22 | - return cb()->redirect(cb()->getDeveloperUrl("login"),"Please login for first"); |
|
21 | + if (session()->get("developer") != getSetting('developer_username')) { |
|
22 | + return cb()->redirect(cb()->getDeveloperUrl("login"), "Please login for first"); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | return $next($request); |
@@ -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) { |
@@ -27,13 +27,13 @@ |
||
27 | 27 | try { |
28 | 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 | 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'], |
@@ -15,8 +15,11 @@ discard block |
||
15 | 15 | |
16 | 16 | public static function has($key) |
17 | 17 | { |
18 | - if(file_exists(app_path("CBPlugins/".$key))) return true; |
|
19 | - else return false; |
|
18 | + if(file_exists(app_path("CBPlugins/".$key))) { |
|
19 | + return true; |
|
20 | + } else { |
|
21 | + return false; |
|
22 | + } |
|
20 | 23 | } |
21 | 24 | |
22 | 25 | public static function isNeedUpgrade($pluginKey, $versionToCompare) |
@@ -24,7 +27,7 @@ discard block |
||
24 | 27 | $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$pluginKey."/plugin.json")), true); |
25 | 28 | if($pluginJson) { |
26 | 29 | return version_compare($pluginJson['version'], $versionToCompare,"!="); |
27 | - }else{ |
|
30 | + } else{ |
|
28 | 31 | return false; |
29 | 32 | } |
30 | 33 | } |
@@ -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 | } |
@@ -34,7 +34,7 @@ |
||
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 | 39 | return cb()->redirectBack(cbLang("something_went_wrong"),"warning"); |
40 | 40 | } |