From 2229586b58e68c99f6d0c0986d9749c88a2d6dd3 Mon Sep 17 00:00:00 2001 From: Ferks-FK Date: Wed, 1 Feb 2023 19:33:36 +0000 Subject: [PATCH] feat: implement laravel-settings --- app/Models/Settings.php | 40 - app/Providers/AppServiceProvider.php | 147 +- app/Settings/GeneralSettings.php | 29 + composer.json | 1 + composer.lock | 261 +++- config/settings.php | 88 ++ ...023_02_01_155140_rename_settings_table.php | 22 + ...02_01_155730_create_new_settings_table.php | 35 + database/seeders/Seeds/SettingsSeeder.php | 1188 +++++++++-------- ...3_02_01_164731_create_general_settings.php | 26 + ..._01_181334_create_pterodactyl_settings.php | 25 + ...2023_02_01_181453_create_mail_settings.php | 30 + ...2023_02_01_181925_create_user_settings.php | 31 + ...23_02_01_181950_create_server_settings.php | 22 + ...3_02_01_182021_create_invoice_settings.php | 29 + ...3_02_01_182043_create_discord_settings.php | 27 + ...23_02_01_182108_create_locale_settings.php | 26 + ..._02_01_182135_create_referral_settings.php | 27 + ...3_02_01_182158_create_website_settings.php | 22 + 19 files changed, 1366 insertions(+), 710 deletions(-) create mode 100644 app/Settings/GeneralSettings.php create mode 100644 config/settings.php create mode 100644 database/migrations/2023_02_01_155140_rename_settings_table.php create mode 100644 database/migrations/2023_02_01_155730_create_new_settings_table.php create mode 100644 database/settings/2023_02_01_164731_create_general_settings.php create mode 100644 database/settings/2023_02_01_181334_create_pterodactyl_settings.php create mode 100644 database/settings/2023_02_01_181453_create_mail_settings.php create mode 100644 database/settings/2023_02_01_181925_create_user_settings.php create mode 100644 database/settings/2023_02_01_181950_create_server_settings.php create mode 100644 database/settings/2023_02_01_182021_create_invoice_settings.php create mode 100644 database/settings/2023_02_01_182043_create_discord_settings.php create mode 100644 database/settings/2023_02_01_182108_create_locale_settings.php create mode 100644 database/settings/2023_02_01_182135_create_referral_settings.php create mode 100644 database/settings/2023_02_01_182158_create_website_settings.php diff --git a/app/Models/Settings.php b/app/Models/Settings.php index ccad0f4a..09713970 100644 --- a/app/Models/Settings.php +++ b/app/Models/Settings.php @@ -4,48 +4,8 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Facades\Cache; class Settings extends Model { use HasFactory; - - protected $table = 'settings'; - - public const CACHE_TAG = 'setting'; - - public $primaryKey = 'key'; - - public $incrementing = false; - - protected $keyType = 'string'; - - protected $fillable = [ - 'key', - 'value', - 'type', - ]; - - public static function boot() - { - parent::boot(); - - static::updated(function (Settings $settings) { - Cache::forget(self::CACHE_TAG.':'.$settings->key); - }); - } - - /** - * @param string $key - * @param $default - * @return mixed - */ - public static function getValueByKey(string $key, $default = null) - { - return Cache::rememberForever(self::CACHE_TAG.':'.$key, function () use ($default, $key) { - $settings = self::find($key); - - return $settings ? $settings->value : $default; - }); - } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 6299bf4f..88e4c3cd 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,7 +2,6 @@ namespace App\Providers; -use App\Models\Settings; use App\Models\UsefulLink; use Exception; use Illuminate\Pagination\Paginator; @@ -64,91 +63,89 @@ class AppServiceProvider extends ServiceProvider } //only run if the installer has been executed - try { - $settings = Settings::all(); - // Set all configs from database - foreach ($settings as $setting) { - config([$setting->key => $setting->value]); - } + // try { + // $settings = Settings::all(); + // // Set all configs from database + // foreach ($settings as $setting) { + // config([$setting->key => $setting->value]); + // } - if (!file_exists(base_path('themes') . "/" . config("SETTINGS::SYSTEM:THEME"))) { - config(['SETTINGS::SYSTEM:THEME' => "default"]); - } + // if(!file_exists(base_path('themes') . "/" . config("SETTINGS::SYSTEM:THEME"))){ + // config(['SETTINGS::SYSTEM:THEME' => "default"]); + // } - if (config('SETTINGS::SYSTEM:THEME') && config('SETTINGS::SYSTEM:THEME') !== config('theme.active')) { - Theme::set(config("SETTINGS::SYSTEM:THEME", "default"), "default"); - } else { - Theme::set("default", "default"); - } + // if(config('SETTINGS::SYSTEM:THEME') !== config('theme.active')){ + // Theme::set(config("SETTINGS::SYSTEM:THEME"), "default"); + // } - // Set Mail Config - //only update config if mail settings have changed in DB - if ( - config('mail.default') != config('SETTINGS:MAIL:MAILER') || - config('mail.mailers.smtp.host') != config('SETTINGS:MAIL:HOST') || - config('mail.mailers.smtp.port') != config('SETTINGS:MAIL:PORT') || - config('mail.mailers.smtp.username') != config('SETTINGS:MAIL:USERNAME') || - config('mail.mailers.smtp.password') != config('SETTINGS:MAIL:PASSWORD') || - config('mail.mailers.smtp.encryption') != config('SETTINGS:MAIL:ENCRYPTION') || - config('mail.from.address') != config('SETTINGS:MAIL:FROM_ADDRESS') || - config('mail.from.name') != config('SETTINGS:MAIL:FROM_NAME') - ) { - config(['mail.default' => config('SETTINGS::MAIL:MAILER')]); - config(['mail.mailers.smtp' => [ - 'transport' => 'smtp', - 'host' => config('SETTINGS::MAIL:HOST'), - 'port' => config('SETTINGS::MAIL:PORT'), - 'encryption' => config('SETTINGS::MAIL:ENCRYPTION'), - 'username' => config('SETTINGS::MAIL:USERNAME'), - 'password' => config('SETTINGS::MAIL:PASSWORD'), - 'timeout' => null, - 'auth_mode' => null, - ]]); - config(['mail.from' => ['address' => config('SETTINGS::MAIL:FROM_ADDRESS'), 'name' => config('SETTINGS::MAIL:FROM_NAME')]]); + // // Set Mail Config + // //only update config if mail settings have changed in DB + // if ( + // config('mail.default') != config('SETTINGS:MAIL:MAILER') || + // config('mail.mailers.smtp.host') != config('SETTINGS:MAIL:HOST') || + // config('mail.mailers.smtp.port') != config('SETTINGS:MAIL:PORT') || + // config('mail.mailers.smtp.username') != config('SETTINGS:MAIL:USERNAME') || + // config('mail.mailers.smtp.password') != config('SETTINGS:MAIL:PASSWORD') || + // config('mail.mailers.smtp.encryption') != config('SETTINGS:MAIL:ENCRYPTION') || + // config('mail.from.address') != config('SETTINGS:MAIL:FROM_ADDRESS') || + // config('mail.from.name') != config('SETTINGS:MAIL:FROM_NAME') + // ) { + // config(['mail.default' => config('SETTINGS::MAIL:MAILER')]); + // config(['mail.mailers.smtp' => [ + // 'transport' => 'smtp', + // 'host' => config('SETTINGS::MAIL:HOST'), + // 'port' => config('SETTINGS::MAIL:PORT'), + // 'encryption' => config('SETTINGS::MAIL:ENCRYPTION'), + // 'username' => config('SETTINGS::MAIL:USERNAME'), + // 'password' => config('SETTINGS::MAIL:PASSWORD'), + // 'timeout' => null, + // 'auth_mode' => null, + // ]]); + // config(['mail.from' => ['address' => config('SETTINGS::MAIL:FROM_ADDRESS'), 'name' => config('SETTINGS::MAIL:FROM_NAME')]]); - Artisan::call('queue:restart'); - } + // Artisan::call('queue:restart'); + // } - // Set Recaptcha API Config - // Load recaptcha package if recaptcha is enabled - if (config('SETTINGS::RECAPTCHA:ENABLED') == 'true') { - $this->app->register(\Biscolab\ReCaptcha\ReCaptchaServiceProvider::class); - } + // // Set Recaptcha API Config + // // Load recaptcha package if recaptcha is enabled + // if (config('SETTINGS::RECAPTCHA:ENABLED') == 'true') { + // $this->app->register(\Biscolab\ReCaptcha\ReCaptchaServiceProvider::class); + // } - //only update config if recaptcha settings have changed in DB - if ( - config('recaptcha.api_site_key') != config('SETTINGS::RECAPTCHA:SITE_KEY') || - config('recaptcha.api_secret_key') != config('SETTINGS::RECAPTCHA:SECRET_KEY') - ) { - config(['recaptcha.api_site_key' => config('SETTINGS::RECAPTCHA:SITE_KEY')]); - config(['recaptcha.api_secret_key' => config('SETTINGS::RECAPTCHA:SECRET_KEY')]); + // //only update config if recaptcha settings have changed in DB + // if ( + // config('recaptcha.api_site_key') != config('SETTINGS::RECAPTCHA:SITE_KEY') || + // config('recaptcha.api_secret_key') != config('SETTINGS::RECAPTCHA:SECRET_KEY') + // ) { + // config(['recaptcha.api_site_key' => config('SETTINGS::RECAPTCHA:SITE_KEY')]); + // config(['recaptcha.api_secret_key' => config('SETTINGS::RECAPTCHA:SECRET_KEY')]); - Artisan::call('config:clear'); - Artisan::call('cache:clear'); - } + // Artisan::call('config:clear'); + // Artisan::call('cache:clear'); + // } - try { - $stringfromfile = file(base_path() . '/.git/HEAD'); + // try { + // $stringfromfile = file(base_path().'/.git/HEAD'); - $firstLine = $stringfromfile[0]; //get the string from the array + // $firstLine = $stringfromfile[0]; //get the string from the array - $explodedstring = explode('/', $firstLine, 3); //seperate out by the "/" in the string + // $explodedstring = explode('/', $firstLine, 3); //seperate out by the "/" in the string - $branchname = $explodedstring[2]; //get the one that is always the branch name - } catch (Exception $e) { - $branchname = 'unknown'; - Log::notice($e); - } - config(['BRANCHNAME' => $branchname]); + // $branchname = $explodedstring[2]; //get the one that is always the branch name + // } catch (Exception $e) { + // $branchname = 'unknown'; + // Log::notice($e); + // } + // config(['BRANCHNAME' => $branchname]); - // Set Discord-API Config - config(['services.discord.client_id' => config('SETTINGS::DISCORD:CLIENT_ID')]); - config(['services.discord.client_secret' => config('SETTINGS::DISCORD:CLIENT_SECRET')]); - } catch (Exception $e) { - error_log('Settings Error: Could not load settings from database. The Installation probably is not done yet.'); - error_log($e); - Log::error('Settings Error: Could not load settings from database. The Installation probably is not done yet.'); - Log::error($e); - } + // // Set Discord-API Config + // config(['services.discord.client_id' => config('SETTINGS::DISCORD:CLIENT_ID')]); + // config(['services.discord.client_secret' => config('SETTINGS::DISCORD:CLIENT_SECRET')]); + // } catch (Exception $e) { + // error_log('Settings Error: Could not load settings from database. The Installation probably is not done yet.'); + // error_log($e); + // Log::error('Settings Error: Could not load settings from database. The Installation probably is not done yet.'); + // Log::error($e); + // } } } diff --git a/app/Settings/GeneralSettings.php b/app/Settings/GeneralSettings.php new file mode 100644 index 00000000..19ebf8ba --- /dev/null +++ b/app/Settings/GeneralSettings.php @@ -0,0 +1,29 @@ + [ + GeneralSettings::class + ], + + /* + * The path where the settings classes will be created. + */ + 'setting_class_path' => app_path('Settings'), + + /* + * In these directories settings migrations will be stored and ran when migrating. A settings + * migration created via the make:settings-migration command will be stored in the first path or + * a custom defined path when running the command. + */ + 'migrations_paths' => [ + database_path('settings'), + ], + + /* + * When no repository was set for a settings class the following repository + * will be used for loading and saving settings. + */ + 'default_repository' => 'database', + + /* + * Settings will be stored and loaded from these repositories. + */ + 'repositories' => [ + 'database' => [ + 'type' => Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, + 'model' => null, + 'table' => null, + 'connection' => null, + ], + 'redis' => [ + 'type' => Spatie\LaravelSettings\SettingsRepositories\RedisSettingsRepository::class, + 'connection' => null, + 'prefix' => null, + ], + ], + + /* + * The contents of settings classes can be cached through your application, + * settings will be stored within a provided Laravel store and can have an + * additional prefix. + */ + 'cache' => [ + 'enabled' => env('SETTINGS_CACHE_ENABLED', false), + 'store' => null, + 'prefix' => null, + 'ttl' => null, + ], + + /* + * These global casts will be automatically used whenever a property within + * your settings class isn't a default PHP type. + */ + 'global_casts' => [ + DateTimeInterface::class => Spatie\LaravelSettings\SettingsCasts\DateTimeInterfaceCast::class, + DateTimeZone::class => Spatie\LaravelSettings\SettingsCasts\DateTimeZoneCast::class, +// Spatie\DataTransferObject\DataTransferObject::class => Spatie\LaravelSettings\SettingsCasts\DtoCast::class, + Spatie\LaravelData\Data::class => Spatie\LaravelSettings\SettingsCasts\DataCast::class, + ], + + /* + * The package will look for settings in these paths and automatically + * register them. + */ + 'auto_discover_settings' => [ + app()->path(), + ], + + /* + * Automatically discovered settings classes can be cached so they don't + * need to be searched each time the application boots up. + */ + 'discovered_settings_cache_path' => storage_path('app/laravel-settings'), +]; diff --git a/database/migrations/2023_02_01_155140_rename_settings_table.php b/database/migrations/2023_02_01_155140_rename_settings_table.php new file mode 100644 index 00000000..89f0995a --- /dev/null +++ b/database/migrations/2023_02_01_155140_rename_settings_table.php @@ -0,0 +1,22 @@ +rename('settings_old'); + }); + } + + public function down() + { + Schema::table('settings', function (Blueprint $table) { + $table->rename("settings"); + }); + } +}; diff --git a/database/migrations/2023_02_01_155730_create_new_settings_table.php b/database/migrations/2023_02_01_155730_create_new_settings_table.php new file mode 100644 index 00000000..66647869 --- /dev/null +++ b/database/migrations/2023_02_01_155730_create_new_settings_table.php @@ -0,0 +1,35 @@ +id(); + $table->string('name'); + $table->json('payload')->nullable(); + $table->string('group')->index(); + $table->boolean('locked'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('settings'); + } +}; diff --git a/database/seeders/Seeds/SettingsSeeder.php b/database/seeders/Seeds/SettingsSeeder.php index accfc06c..65773e0b 100644 --- a/database/seeders/Seeds/SettingsSeeder.php +++ b/database/seeders/Seeds/SettingsSeeder.php @@ -4,6 +4,7 @@ namespace Database\Seeders\Seeds; use App\Models\Settings; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\DB; class SettingsSeeder extends Seeder { @@ -14,6 +15,7 @@ class SettingsSeeder extends Seeder */ public function run() { + DB::table('settings_old', 'old')->where(''); //initials Settings::firstOrCreate([ 'key' => 'SETTINGS::USER:INITIAL_CREDITS', @@ -23,634 +25,634 @@ class SettingsSeeder extends Seeder 'description' => 'The initial amount of credits the user starts with.', ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::USER:INITIAL_SERVER_LIMIT', - ], [ - 'value' => '1', - 'type' => 'integer', - 'description' => 'The initial server limit the user starts with.', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::USER:INITIAL_SERVER_LIMIT', +// ], [ +// 'value' => '1', +// 'type' => 'integer', +// 'description' => 'The initial server limit the user starts with.', +// ]); - //verify email event - Settings::firstOrCreate([ - 'key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL', - ], [ - 'value' => '250', - 'type' => 'integer', - 'description' => 'Increase in credits after the user has verified their email account.', - ]); +// //verify email event +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL', +// ], [ +// 'value' => '250', +// 'type' => 'integer', +// 'description' => 'Increase in credits after the user has verified their email account.', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL', - ], [ - 'value' => '2', - 'type' => 'integer', - 'description' => 'Increase in server limit after the user has verified their email account.', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL', +// ], [ +// 'value' => '2', +// 'type' => 'integer', +// 'description' => 'Increase in server limit after the user has verified their email account.', +// ]); - //verify discord event - Settings::firstOrCreate([ - 'key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD', - ], [ - 'value' => '375', - 'type' => 'integer', - 'description' => 'Increase in credits after the user has verified their discord account.', - ]); +// //verify discord event +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD', +// ], [ +// 'value' => '375', +// 'type' => 'integer', +// 'description' => 'Increase in credits after the user has verified their discord account.', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD', - ], [ - 'value' => '2', - 'type' => 'integer', - 'description' => 'Increase in server limit after the user has verified their discord account.', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD', +// ], [ +// 'value' => '2', +// 'type' => 'integer', +// 'description' => 'Increase in server limit after the user has verified their discord account.', +// ]); - //other - Settings::firstOrCreate([ - 'key' => 'SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', - ], [ - 'value' => '50', - 'type' => 'integer', - 'description' => 'The minimum amount of credits the user would need to make a server.', - ]); +// //other +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', +// ], [ +// 'value' => '50', +// 'type' => 'integer', +// 'description' => 'The minimum amount of credits the user would need to make a server.', +// ]); - //purchasing - Settings::firstOrCreate([ - 'key' => 'SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE', - ], [ - 'value' => '10', - 'type' => 'integer', - 'description' => 'updates the users server limit to this amount (unless the user already has a higher server limit) after making a purchase with real money, set to 0 to ignore this.', - ]); +// //purchasing +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE', +// ], [ +// 'value' => '10', +// 'type' => 'integer', +// 'description' => 'updates the users server limit to this amount (unless the user already has a higher server limit) after making a purchase with real money, set to 0 to ignore this.', +// ]); - //force email and discord verification - Settings::firstOrCreate([ - 'key' => 'SETTINGS::USER:FORCE_EMAIL_VERIFICATION', - ], [ - 'value' => 'false', - 'type' => 'boolean', - 'description' => 'Force an user to verify the email adress before creating a server / buying credits.', - ]); +// //force email and discord verification +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::USER:FORCE_EMAIL_VERIFICATION', +// ], [ +// 'value' => 'false', +// 'type' => 'boolean', +// 'description' => 'Force an user to verify the email adress before creating a server / buying credits.', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::USER:FORCE_DISCORD_VERIFICATION', - ], [ - 'value' => 'false', - 'type' => 'boolean', - 'description' => 'Force an user to link an Discord Account before creating a server / buying credits.', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::USER:FORCE_DISCORD_VERIFICATION', +// ], [ +// 'value' => 'false', +// 'type' => 'boolean', +// 'description' => 'Force an user to link an Discord Account before creating a server / buying credits.', +// ]); - //disable ip check on register - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:REGISTER_IP_CHECK', - ], [ - 'value' => 'true', - 'type' => 'boolean', - 'description' => 'Prevent users from making multiple accounts using the same IP address', - ]); +// //disable ip check on register +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:REGISTER_IP_CHECK', +// ], [ +// 'value' => 'true', +// 'type' => 'boolean', +// 'description' => 'Prevent users from making multiple accounts using the same IP address', +// ]); - //per_page on allocations request - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SERVER:ALLOCATION_LIMIT', - ], [ - 'value' => '200', - 'type' => 'integer', - 'description' => 'The maximum amount of allocations to pull per node for automatic deployment, if more allocations are being used than this limit is set to, no new servers can be created!', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', - ], [ - 'value' => '0', - 'type' => 'integer', - 'description' => 'The minimum amount of credits user has to have to create a server. Can be overridden by package limits.' - ]); +// //per_page on allocations request +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SERVER:ALLOCATION_LIMIT', +// ], [ +// 'value' => '200', +// 'type' => 'integer', +// 'description' => 'The maximum amount of allocations to pull per node for automatic deployment, if more allocations are being used than this limit is set to, no new servers can be created!', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', +// ], [ +// 'value' => '0', +// 'type' => 'integer', +// 'description' => 'The minimum amount of credits user has to have to create a server. Can be overridden by package limits.' +// ]); - //credits display name - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME', - ], [ - 'value' => 'Credits', - 'type' => 'string', - 'description' => 'The display name of your currency.', - ]); +// //credits display name +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME', +// ], [ +// 'value' => 'Credits', +// 'type' => 'string', +// 'description' => 'The display name of your currency.', +// ]); - //credits display name - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR', - ], [ - 'value' => 'true', - 'type' => 'boolean', - 'description' => 'Charges the first hour worth of credits upon creating a server.', - ]); - //sales tax - Settings::firstOrCreate([ - 'key' => 'SETTINGS::PAYMENTS:SALES_TAX', - ], [ - 'value' => '0', - 'type' => 'integer', - 'description' => 'The %-value of tax that will be added to the product price on checkout.', - ]); - //Invoices enabled - Settings::firstOrCreate([ - 'key' => 'SETTINGS::INVOICE:ENABLED', - ], [ - 'value' => 'false', - 'type' => 'boolean', - 'description' => 'Enables or disables the invoice feature for payments.', - ]); - //Invoice company name - Settings::firstOrCreate([ - 'key' => 'SETTINGS::INVOICE:COMPANY_NAME', - ], [ - 'value' => '', - 'type' => 'string', - 'description' => 'The name of the Company on the Invoices.', - ]); - //Invoice company address - Settings::firstOrCreate([ - 'key' => 'SETTINGS::INVOICE:COMPANY_ADDRESS', - ], [ - 'value' => '', - 'type' => 'string', - 'description' => 'The address of the Company on the Invoices.', - ]); - //Invoice company phone - Settings::firstOrCreate([ - 'key' => 'SETTINGS::INVOICE:COMPANY_PHONE', - ], [ - 'value' => '', - 'type' => 'string', - 'description' => 'The phone number of the Company on the Invoices.', - ]); +// //credits display name +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR', +// ], [ +// 'value' => 'true', +// 'type' => 'boolean', +// 'description' => 'Charges the first hour worth of credits upon creating a server.', +// ]); +// //sales tax +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::PAYMENTS:SALES_TAX', +// ], [ +// 'value' => '0', +// 'type' => 'integer', +// 'description' => 'The %-value of tax that will be added to the product price on checkout.', +// ]); +// //Invoices enabled +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::INVOICE:ENABLED', +// ], [ +// 'value' => 'false', +// 'type' => 'boolean', +// 'description' => 'Enables or disables the invoice feature for payments.', +// ]); +// //Invoice company name +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::INVOICE:COMPANY_NAME', +// ], [ +// 'value' => '', +// 'type' => 'string', +// 'description' => 'The name of the Company on the Invoices.', +// ]); +// //Invoice company address +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::INVOICE:COMPANY_ADDRESS', +// ], [ +// 'value' => '', +// 'type' => 'string', +// 'description' => 'The address of the Company on the Invoices.', +// ]); +// //Invoice company phone +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::INVOICE:COMPANY_PHONE', +// ], [ +// 'value' => '', +// 'type' => 'string', +// 'description' => 'The phone number of the Company on the Invoices.', +// ]); - //Invoice company mail - Settings::firstOrCreate([ - 'key' => 'SETTINGS::INVOICE:COMPANY_MAIL', - ], [ - 'value' => '', - 'type' => 'string', - 'description' => 'The email address of the Company on the Invoices.', - ]); +// //Invoice company mail +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::INVOICE:COMPANY_MAIL', +// ], [ +// 'value' => '', +// 'type' => 'string', +// 'description' => 'The email address of the Company on the Invoices.', +// ]); - //Invoice VAT - Settings::firstOrCreate([ - 'key' => 'SETTINGS::INVOICE:COMPANY_VAT', - ], [ - 'value' => '', - 'type' => 'string', - 'description' => 'The VAT-Number of the Company on the Invoices.', - ]); +// //Invoice VAT +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::INVOICE:COMPANY_VAT', +// ], [ +// 'value' => '', +// 'type' => 'string', +// 'description' => 'The VAT-Number of the Company on the Invoices.', +// ]); - //Invoice Website - Settings::firstOrCreate([ - 'key' => 'SETTINGS::INVOICE:COMPANY_WEBSITE', - ], [ - 'value' => '', - 'type' => 'string', - 'description' => 'The Website of the Company on the Invoices.', - ]); +// //Invoice Website +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::INVOICE:COMPANY_WEBSITE', +// ], [ +// 'value' => '', +// 'type' => 'string', +// 'description' => 'The Website of the Company on the Invoices.', +// ]); - //Invoice Website - Settings::firstOrCreate([ - 'key' => 'SETTINGS::INVOICE:PREFIX', - ], [ - 'value' => 'INV', - 'type' => 'string', - 'description' => 'The invoice prefix.', - ]); +// //Invoice Website +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::INVOICE:PREFIX', +// ], [ +// 'value' => 'INV', +// 'type' => 'string', +// 'description' => 'The invoice prefix.', +// ]); - //Locale - Settings::firstOrCreate([ - 'key' => 'SETTINGS::LOCALE:DEFAULT', - ], [ - 'value' => 'en', - 'type' => 'string', - 'description' => 'The default dashboard language.', - ]); - //Dynamic locale - Settings::firstOrCreate([ - 'key' => 'SETTINGS::LOCALE:DYNAMIC', - ], [ - 'value' => 'false', - 'type' => 'boolean', - 'description' => 'If this is true, the Language will change to the Clients browserlanguage or default.', - ]); - //User can change Locale - Settings::firstOrCreate([ - 'key' => 'SETTINGS::LOCALE:CLIENTS_CAN_CHANGE', - ], [ - 'value' => 'false', - 'type' => 'boolean', - 'description' => 'If this is true, the clients will be able to change their Locale.', - ]); - //Locale - Settings::firstOrCreate([ - 'key' => 'SETTINGS::LOCALE:AVAILABLE', - ], [ - 'value' => 'en', - 'type' => 'string', - 'description' => 'The available languages.', - ]); - //Locale - Settings::firstOrCreate([ - 'key' => 'SETTINGS::LOCALE:DATATABLES', - ], [ - 'value' => 'en-gb', - 'type' => 'string', - 'description' => 'The Language of the Datatables. Grab the Language-Codes from here https://datatables.net/plug-ins/i18n/', - ]); +// //Locale +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::LOCALE:DEFAULT', +// ], [ +// 'value' => 'en', +// 'type' => 'string', +// 'description' => 'The default dashboard language.', +// ]); +// //Dynamic locale +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::LOCALE:DYNAMIC', +// ], [ +// 'value' => 'false', +// 'type' => 'boolean', +// 'description' => 'If this is true, the Language will change to the Clients browserlanguage or default.', +// ]); +// //User can change Locale +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::LOCALE:CLIENTS_CAN_CHANGE', +// ], [ +// 'value' => 'false', +// 'type' => 'boolean', +// 'description' => 'If this is true, the clients will be able to change their Locale.', +// ]); +// //Locale +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::LOCALE:AVAILABLE', +// ], [ +// 'value' => 'en', +// 'type' => 'string', +// 'description' => 'The available languages.', +// ]); +// //Locale +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::LOCALE:DATATABLES', +// ], [ +// 'value' => 'en-gb', +// 'type' => 'string', +// 'description' => 'The Language of the Datatables. Grab the Language-Codes from here https://datatables.net/plug-ins/i18n/', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::PAYMENTS:PAYPAL:SECRET', - ], [ - 'value' => env('PAYPAL_SECRET', ''), - 'type' => 'string', - 'description' => 'Your PayPal Secret-Key (https://developer.paypal.com/docs/integration/direct/rest/).', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID', - ], [ - 'value' => env('PAYPAL_CLIENT_ID', ''), - 'type' => 'string', - 'description' => 'Your PayPal Client_ID.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::PAYMENTS:PAYPAL:SANDBOX_SECRET', - ], [ - 'value' => env('PAYPAL_SANDBOX_SECRET', ''), - 'type' => 'string', - 'description' => 'Your PayPal SANDBOX Secret-Key used for testing.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::PAYMENTS:PAYPAL:SANDBOX_CLIENT_ID', - ], [ - 'value' => env('PAYPAL_SANDBOX_CLIENT_ID', ''), - 'type' => 'string', - 'description' => 'Your PayPal SANDBOX Client-ID used for testing.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::PAYMENTS:STRIPE:SECRET', - ], [ - 'value' => env('STRIPE_SECRET', ''), - 'type' => 'string', - 'description' => 'Your Stripe Secret-Key (https://dashboard.stripe.com/account/apikeys).', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET', - ], [ - 'value' => env('STRIPE_ENDPOINT_SECRET', ''), - 'type' => 'string', - 'description' => 'Your Stripe endpoint secret-key.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::PAYMENTS:STRIPE:TEST_SECRET', - ], [ - 'value' => env('STRIPE_TEST_SECRET', ''), - 'type' => 'string', - 'description' => 'Your Stripe test secret-key.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET', - ], [ - 'value' => env('STRIPE_ENDPOINT_TEST_SECRET', ''), - 'type' => 'string', - 'description' => 'Your Stripe endpoint test secret-key.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::PAYMENTS:STRIPE:METHODS', - ], [ - 'value' => env('STRIPE_METHODS', 'card,sepa_debit'), - 'type' => 'string', - 'description' => 'Comma seperated list of payment methods that are enabled (https://stripe.com/docs/payments/payment-methods/integration-options).', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::PAYMENTS:PAYPAL:SECRET', +// ], [ +// 'value' => env('PAYPAL_SECRET', ''), +// 'type' => 'string', +// 'description' => 'Your PayPal Secret-Key (https://developer.paypal.com/docs/integration/direct/rest/).', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID', +// ], [ +// 'value' => env('PAYPAL_CLIENT_ID', ''), +// 'type' => 'string', +// 'description' => 'Your PayPal Client_ID.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::PAYMENTS:PAYPAL:SANDBOX_SECRET', +// ], [ +// 'value' => env('PAYPAL_SANDBOX_SECRET', ''), +// 'type' => 'string', +// 'description' => 'Your PayPal SANDBOX Secret-Key used for testing.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::PAYMENTS:PAYPAL:SANDBOX_CLIENT_ID', +// ], [ +// 'value' => env('PAYPAL_SANDBOX_CLIENT_ID', ''), +// 'type' => 'string', +// 'description' => 'Your PayPal SANDBOX Client-ID used for testing.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::PAYMENTS:STRIPE:SECRET', +// ], [ +// 'value' => env('STRIPE_SECRET', ''), +// 'type' => 'string', +// 'description' => 'Your Stripe Secret-Key (https://dashboard.stripe.com/account/apikeys).', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET', +// ], [ +// 'value' => env('STRIPE_ENDPOINT_SECRET', ''), +// 'type' => 'string', +// 'description' => 'Your Stripe endpoint secret-key.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::PAYMENTS:STRIPE:TEST_SECRET', +// ], [ +// 'value' => env('STRIPE_TEST_SECRET', ''), +// 'type' => 'string', +// 'description' => 'Your Stripe test secret-key.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET', +// ], [ +// 'value' => env('STRIPE_ENDPOINT_TEST_SECRET', ''), +// 'type' => 'string', +// 'description' => 'Your Stripe endpoint test secret-key.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::PAYMENTS:STRIPE:METHODS', +// ], [ +// 'value' => env('STRIPE_METHODS', 'card,sepa_debit'), +// 'type' => 'string', +// 'description' => 'Comma seperated list of payment methods that are enabled (https://stripe.com/docs/payments/payment-methods/integration-options).', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::DISCORD:CLIENT_ID', - ], [ - 'value' => env('DISCORD_CLIENT_ID', ''), - 'type' => 'string', - 'description' => 'Discord API Credentials (https://discordapp.com/developers/applications/).', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::DISCORD:CLIENT_ID', +// ], [ +// 'value' => env('DISCORD_CLIENT_ID', ''), +// 'type' => 'string', +// 'description' => 'Discord API Credentials (https://discordapp.com/developers/applications/).', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::DISCORD:CLIENT_SECRET', - ], [ - 'value' => env('DISCORD_CLIENT_SECRET', ''), - 'type' => 'string', - 'description' => 'Discord API Credentials (https://discordapp.com/developers/applications/).', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::DISCORD:BOT_TOKEN', - ], [ - 'value' => env('DISCORD_BOT_TOKEN', ''), - 'type' => 'string', - 'description' => 'Discord API Credentials (https://discordapp.com/developers/applications/).', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::DISCORD:CLIENT_SECRET', +// ], [ +// 'value' => env('DISCORD_CLIENT_SECRET', ''), +// 'type' => 'string', +// 'description' => 'Discord API Credentials (https://discordapp.com/developers/applications/).', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::DISCORD:BOT_TOKEN', +// ], [ +// 'value' => env('DISCORD_BOT_TOKEN', ''), +// 'type' => 'string', +// 'description' => 'Discord API Credentials (https://discordapp.com/developers/applications/).', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::DISCORD:GUILD_ID', - ], [ - 'value' => env('DISCORD_GUILD_ID', ''), - 'type' => 'string', - 'description' => 'Discord API Credentials (https://discordapp.com/developers/applications/).', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::DISCORD:GUILD_ID', +// ], [ +// 'value' => env('DISCORD_GUILD_ID', ''), +// 'type' => 'string', +// 'description' => 'Discord API Credentials (https://discordapp.com/developers/applications/).', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::DISCORD:ROLE_ID', - ], [ - 'value' => env('DISCORD_ROLE_ID', ''), - 'type' => 'string', - 'description' => 'Discord role that will be assigned to users when they register.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::DISCORD:INVITE_URL', - ], [ - 'value' => env('DISCORD_INVITE_URL', ''), - 'type' => 'string', - 'description' => 'The invite URL to your Discord Server.', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::DISCORD:ROLE_ID', +// ], [ +// 'value' => env('DISCORD_ROLE_ID', ''), +// 'type' => 'string', +// 'description' => 'Discord role that will be assigned to users when they register.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::DISCORD:INVITE_URL', +// ], [ +// 'value' => env('DISCORD_INVITE_URL', ''), +// 'type' => 'string', +// 'description' => 'The invite URL to your Discord Server.', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN', - ], [ - 'value' => env('PTERODACTYL_TOKEN', ''), - 'type' => 'string', - 'description' => 'Admin API Token from Pterodactyl Panel - necessary for the Panel to work. The Key needs all read&write permissions!', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:URL', - ], [ - 'value' => env('PTERODACTYL_URL', ''), - 'type' => 'string', - 'description' => 'The URL to your Pterodactyl Panel. Must not end with a / ', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT', - ], [ - 'value' => 200, - 'type' => 'integer', - 'description' => 'The Pterodactyl API perPage limit. It is necessary to set it higher than your server count.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::MISC:PHPMYADMIN:URL', - ], [ - 'value' => env('PHPMYADMIN_URL', ''), - 'type' => 'string', - 'description' => 'The URL to your PHPMYADMIN Panel. Must not end with a /, remove to remove database button', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN', +// ], [ +// 'value' => env('PTERODACTYL_TOKEN', ''), +// 'type' => 'string', +// 'description' => 'Admin API Token from Pterodactyl Panel - necessary for the Panel to work. The Key needs all read&write permissions!', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:URL', +// ], [ +// 'value' => env('PTERODACTYL_URL', ''), +// 'type' => 'string', +// 'description' => 'The URL to your Pterodactyl Panel. Must not end with a / ', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT', +// ], [ +// 'value' => 200, +// 'type' => 'integer', +// 'description' => 'The Pterodactyl API perPage limit. It is necessary to set it higher than your server count.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::MISC:PHPMYADMIN:URL', +// ], [ +// 'value' => env('PHPMYADMIN_URL', ''), +// 'type' => 'string', +// 'description' => 'The URL to your PHPMYADMIN Panel. Must not end with a /, remove to remove database button', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::RECAPTCHA:SITE_KEY', - ], [ - 'value' => env('RECAPTCHA_SITE_KEY', '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'), - 'type' => 'string', - 'description' => 'Google Recaptcha API Credentials (https://www.google.com/recaptcha/admin) - reCaptcha V2 (not v3)', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::RECAPTCHA:SITE_KEY', +// ], [ +// 'value' => env('RECAPTCHA_SITE_KEY', '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'), +// 'type' => 'string', +// 'description' => 'Google Recaptcha API Credentials (https://www.google.com/recaptcha/admin) - reCaptcha V2 (not v3)', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::RECAPTCHA:SECRET_KEY', - ], [ - 'value' => env('RECAPTCHA_SECRET_KEY', '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'), - 'type' => 'string', - 'description' => 'Google Recaptcha API Credentials (https://www.google.com/recaptcha/admin) - reCaptcha V2 (not v3)', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::RECAPTCHA:ENABLED', - ], [ - 'value' => 'true', - 'type' => 'boolean', - 'description' => 'Enables or disables the ReCaptcha feature on the registration/login page.', +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::RECAPTCHA:SECRET_KEY', +// ], [ +// 'value' => env('RECAPTCHA_SECRET_KEY', '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'), +// 'type' => 'string', +// 'description' => 'Google Recaptcha API Credentials (https://www.google.com/recaptcha/admin) - reCaptcha V2 (not v3)', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::RECAPTCHA:ENABLED', +// ], [ +// 'value' => 'true', +// 'type' => 'boolean', +// 'description' => 'Enables or disables the ReCaptcha feature on the registration/login page.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::MAIL:MAILER', - ], [ - 'value' => env('MAIL_MAILER', 'smtp'), - 'type' => 'string', - 'description' => 'Selected Mailer (smtp, mailgun, sendgrid, mailtrap).', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::MAIL:HOST', - ], [ - 'value' => env('MAIL_HOST', 'localhost'), - 'type' => 'string', - 'description' => 'Mailer Host Address.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::MAIL:PORT', - ], [ - 'value' => env('MAIL_PORT', '25'), - 'type' => 'string', - 'description' => 'Mailer Server Port.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::MAIL:USERNAME', - ], [ - 'value' => env('MAIL_USERNAME', ''), - 'type' => 'string', - 'description' => 'Mailer Username.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::MAIL:PASSWORD', - ], [ - 'value' => env('MAIL_PASSWORD', ''), - 'type' => 'string', - 'description' => 'Mailer Password.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::MAIL:ENCRYPTION', - ], [ - 'value' => env('MAIL_ENCRYPTION', 'tls'), - 'type' => 'string', - 'description' => 'Mailer Encryption (tls, ssl).', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::MAIL:FROM_ADDRESS', - ], [ - 'value' => env('MAIL_FROM_ADDRESS', ''), - 'type' => 'string', - 'description' => 'Mailer From Address.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::MAIL:FROM_NAME', - ], [ - 'value' => env('APP_NAME', 'Controlpanel'), - 'type' => 'string', - 'description' => 'Mailer From Name.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::REFERRAL::ENABLED', - ], [ - 'value' => 'false', - 'type' => 'string', - 'description' => 'Enable or disable the referral system.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::REFERRAL::ALWAYS_GIVE_COMMISSION', - ], [ - 'value' => 'false', - 'type' => 'string', - 'description' => 'Whether referrals get percentage commission only on first purchase or on every purchase', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::REFERRAL::REWARD', - ], [ - 'value' => 100, - 'type' => 'integer', - 'description' => 'Credit reward a user should receive when a user registers with his referral code', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::REFERRAL::ALLOWED', - ], [ - 'value' => 'client', - 'type' => 'string', - 'description' => 'Who should be allowed to to use the referral code. all/client', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::REFERRAL:MODE', - ], [ - 'value' => 'sign-up', - 'type' => 'string', - 'description' => 'Whether referrals get Credits on User-Registration or if a User buys credits', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::REFERRAL:PERCENTAGE', - ], [ - 'value' => 100, - 'type' => 'integer', - 'description' => 'The Percentage value a referred user gets.', - ]); +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::MAIL:MAILER', +// ], [ +// 'value' => env('MAIL_MAILER', 'smtp'), +// 'type' => 'string', +// 'description' => 'Selected Mailer (smtp, mailgun, sendgrid, mailtrap).', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::MAIL:HOST', +// ], [ +// 'value' => env('MAIL_HOST', 'localhost'), +// 'type' => 'string', +// 'description' => 'Mailer Host Address.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::MAIL:PORT', +// ], [ +// 'value' => env('MAIL_PORT', '25'), +// 'type' => 'string', +// 'description' => 'Mailer Server Port.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::MAIL:USERNAME', +// ], [ +// 'value' => env('MAIL_USERNAME', ''), +// 'type' => 'string', +// 'description' => 'Mailer Username.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::MAIL:PASSWORD', +// ], [ +// 'value' => env('MAIL_PASSWORD', ''), +// 'type' => 'string', +// 'description' => 'Mailer Password.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::MAIL:ENCRYPTION', +// ], [ +// 'value' => env('MAIL_ENCRYPTION', 'tls'), +// 'type' => 'string', +// 'description' => 'Mailer Encryption (tls, ssl).', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::MAIL:FROM_ADDRESS', +// ], [ +// 'value' => env('MAIL_FROM_ADDRESS', ''), +// 'type' => 'string', +// 'description' => 'Mailer From Address.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::MAIL:FROM_NAME', +// ], [ +// 'value' => env('APP_NAME', 'Controlpanel'), +// 'type' => 'string', +// 'description' => 'Mailer From Name.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::REFERRAL::ENABLED', +// ], [ +// 'value' => 'false', +// 'type' => 'string', +// 'description' => 'Enable or disable the referral system.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::REFERRAL::ALWAYS_GIVE_COMMISSION', +// ], [ +// 'value' => 'false', +// 'type' => 'string', +// 'description' => 'Whether referrals get percentage commission only on first purchase or on every purchase', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::REFERRAL::REWARD', +// ], [ +// 'value' => 100, +// 'type' => 'integer', +// 'description' => 'Credit reward a user should receive when a user registers with his referral code', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::REFERRAL::ALLOWED', +// ], [ +// 'value' => 'client', +// 'type' => 'string', +// 'description' => 'Who should be allowed to to use the referral code. all/client', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::REFERRAL:MODE', +// ], [ +// 'value' => 'sign-up', +// 'type' => 'string', +// 'description' => 'Whether referrals get Credits on User-Registration or if a User buys credits', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::REFERRAL:PERCENTAGE', +// ], [ +// 'value' => 100, +// 'type' => 'integer', +// 'description' => 'The Percentage value a referred user gets.', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN', - ], [ - 'value' => '', - 'type' => 'string', - 'description' => 'The Client API Key of an Pterodactyl Admin Account.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:ENABLE_UPGRADE', - ], [ - 'value' => 'false', - 'type' => 'boolean', - 'description' => 'Enables the updgrade/downgrade feature for servers.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS', - ], [ - 'value' => 'true', - 'type' => 'boolean', - 'description' => 'Enable creation of new servers', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:CREATION_OF_NEW_USERS', - ], [ - 'value' => 'true', - 'type' => 'boolean', - 'description' => 'Enable creation of new users', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:SHOW_IMPRINT', - ], [ +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN', +// ], [ +// 'value' => '', +// 'type' => 'string', +// 'description' => 'The Client API Key of an Pterodactyl Admin Account.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:ENABLE_UPGRADE', +// ], [ +// 'value' => 'false', +// 'type' => 'boolean', +// 'description' => 'Enables the updgrade/downgrade feature for servers.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS', +// ], [ +// 'value' => 'true', +// 'type' => 'boolean', +// 'description' => 'Enable creation of new servers', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:CREATION_OF_NEW_USERS', +// ], [ +// 'value' => 'true', +// 'type' => 'boolean', +// 'description' => 'Enable creation of new users', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:SHOW_IMPRINT', +// ], [ - 'value' => "false", - 'type' => 'boolean', - 'description' => 'Enable imprint in footer.' +// 'value' => "false", +// 'type' => 'boolean', +// 'description' => 'Enable imprint in footer.' - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:SHOW_PRIVACY', - ], [ +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:SHOW_PRIVACY', +// ], [ - 'value' => "false", - 'type' => 'boolean', - 'description' => 'Enable privacy policy in footer.' +// 'value' => "false", +// 'type' => 'boolean', +// 'description' => 'Enable privacy policy in footer.' - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:SHOW_TOS', - ], [ - 'value' => 'false', - 'type' => 'boolean', - 'description' => 'Enable Terms of Service in footer.', - ]); +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:SHOW_TOS', +// ], [ +// 'value' => 'false', +// 'type' => 'boolean', +// 'description' => 'Enable Terms of Service in footer.', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:ALERT_ENABLED', - ], [ - 'value' => 'false', - 'type' => 'boolean', - 'description' => 'Enable Alerts on Homepage.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:ALERT_TYPE', - ], [ - 'value' => 'dark', - 'type' => 'text', - 'description' => 'Changes the Color of the Alert.', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:ALERT_ENABLED', +// ], [ +// 'value' => 'false', +// 'type' => 'boolean', +// 'description' => 'Enable Alerts on Homepage.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:ALERT_TYPE', +// ], [ +// 'value' => 'dark', +// 'type' => 'text', +// 'description' => 'Changes the Color of the Alert.', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:ALERT_MESSAGE', - ], [ - 'value' => '', - 'type' => 'text', - 'description' => 'Changes the Content the Alert.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:THEME', - ], [ - 'value' => 'default', - 'type' => 'text', - 'description' => 'Current active theme.', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:ALERT_MESSAGE', +// ], [ +// 'value' => '', +// 'type' => 'text', +// 'description' => 'Changes the Content the Alert.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:THEME', +// ], [ +// 'value' => 'default', +// 'type' => 'text', +// 'description' => 'Current active theme.', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:USEFULLINKS_ENABLED', - ], [ - 'value' => 'true', - 'type' => 'boolean', - 'description' => 'Enable Useful Links on Homepage.', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:USEFULLINKS_ENABLED', +// ], [ +// 'value' => 'true', +// 'type' => 'boolean', +// 'description' => 'Enable Useful Links on Homepage.', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:MOTD_ENABLED', - ], [ - 'value' => 'true', - 'type' => 'boolean', - 'description' => 'Enable MOTD on Homepage.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:MOTD_MESSAGE', - ], [ - 'value' => '

Controlpanel.gg

-

Thank you for using our Software

-

If you have any questions, make sure to join our Discord

-

(you can change this message in the Settings )

', - 'type' => 'text', - 'description' => 'MOTD Message.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:SEO_TITLE', - ], [ - 'value' => 'Controlpanel.gg', - 'type' => 'text', - 'description' => 'The SEO Title.', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:MOTD_ENABLED', +// ], [ +// 'value' => 'true', +// 'type' => 'boolean', +// 'description' => 'Enable MOTD on Homepage.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:MOTD_MESSAGE', +// ], [ +// 'value' => '

Controlpanel.gg

+//

Thank you for using our Software

+//

If you have any questions, make sure to join our Discord

+//

(you can change this message in the Settings )

', +// 'type' => 'text', +// 'description' => 'MOTD Message.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:SEO_TITLE', +// ], [ +// 'value' => 'Controlpanel.gg', +// 'type' => 'text', +// 'description' => 'The SEO Title.', +// ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::SYSTEM:SEO_DESCRIPTION', - ], [ - 'value' => 'Billing software for Pterodactyl Dashboard!', - 'type' => 'text', - 'description' => 'SEO Description.', - ]); - Settings::firstOrCreate([ - 'key' => 'SETTINGS::TICKET:NOTIFY', - ], [ - 'value' => 'all', - 'type' => 'text', - 'description' => 'Who will get a Email Notifcation on new Tickets.', - ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::SYSTEM:SEO_DESCRIPTION', +// ], [ +// 'value' => 'Billing software for Pterodactyl Dashboard!', +// 'type' => 'text', +// 'description' => 'SEO Description.', +// ]); +// Settings::firstOrCreate([ +// 'key' => 'SETTINGS::TICKET:NOTIFY', +// ], [ +// 'value' => 'all', +// 'type' => 'text', +// 'description' => 'Who will get a Email Notifcation on new Tickets.', +// ]); } } diff --git a/database/settings/2023_02_01_164731_create_general_settings.php b/database/settings/2023_02_01_164731_create_general_settings.php new file mode 100644 index 00000000..ff3eb1cf --- /dev/null +++ b/database/settings/2023_02_01_164731_create_general_settings.php @@ -0,0 +1,26 @@ +migrator->add('general.credits_display_name', ($this->getOldValue('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME') != null) ?: 'Credits'); + $this->migrator->add('general.register_ip_check', ($this->getOldValue("SETTINGS::SYSTEM:REGISTER_IP_CHECK") != null) ?: true); + $this->migrator->add('general.initial_user_credits', ($this->getOldValue("SETTINGS::USER:INITIAL_CREDITS") != null) ?: 250); + $this->migrator->add('general.initial_server_limit', ($this->getOldValue("SETTINGS::USER:INITIAL_SERVER_LIMIT") != null) ?: 1); + $this->migrator->add('general.main_site', ""); + } + + public function getOldValue(string $key) + { + if (DB::table('settings_old')->exists()) { + return DB::table('settings_old')->where('key', '=', $key)->get(['value']); + } + + return null; + } +} \ No newline at end of file diff --git a/database/settings/2023_02_01_181334_create_pterodactyl_settings.php b/database/settings/2023_02_01_181334_create_pterodactyl_settings.php new file mode 100644 index 00000000..6bc39486 --- /dev/null +++ b/database/settings/2023_02_01_181334_create_pterodactyl_settings.php @@ -0,0 +1,25 @@ +migrator->add('pterodactyl.admin_token', ($this->getOldValue('SETTINGS::SYSTEM:PTERODACTYL:TOKEN') != null) ?: env('PTERODACTYL_TOKEN', '')); + $this->migrator->add('pterodactyl.user_token', ($this->getOldValue('SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN') != null) ?: ''); + $this->migrator->add('pterodactyl.panel_url', ($this->getOldValue('SETTINGS::SYSTEM:PTERODACTYL:URL') != null) ?: env('PTERODACTYL_URL', '')); + $this->migrator->add('pterodactyl.per_page_limit', ($this->getOldValue('SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT') != null) ?: 200); + } + + public function getOldValue(string $key) + { + if (DB::table('settings_old')->exists()) { + return DB::table('settings_old')->where('key', '=', $key)->get(['value']); + } + + return null; + } +} \ No newline at end of file diff --git a/database/settings/2023_02_01_181453_create_mail_settings.php b/database/settings/2023_02_01_181453_create_mail_settings.php new file mode 100644 index 00000000..7ba84bc1 --- /dev/null +++ b/database/settings/2023_02_01_181453_create_mail_settings.php @@ -0,0 +1,30 @@ +migrator->add('mail.mail_host', ($this->getOldValue('SETTINGS::MAIL:HOST') != null) ?: ''); + $this->migrator->add('mail.mail_port', ($this->getOldValue('SETTINGS::MAIL:PORT') != null) ?: 'mailhog'); + $this->migrator->add('mail.mail_username', ($this->getOldValue('SETTINGS::MAIL:USERNAME') != null) ?: null); + $this->migrator->add('mail.mail_password', ($this->getOldValue('SETTINGS::MAIL:PASSWORD') != null) ?: null); + $this->migrator->add('mail.mail_encryption', ($this->getOldValue('SETTINGS::MAIL:ENCRYPTION') != null) ?: null); + $this->migrator->add('mail.mail_from_address', ($this->getOldValue('SETTINGS::MAIL:FROM_ADDRESS') != null) ?: null); + $this->migrator->add('mail.mail_from_name', ($this->getOldValue('SETTINGS::MAIL:FROM_NAME') != null) ?: 'ControlPanel.gg'); + $this->migrator->add('mail.mail_mailer', ($this->getOldValue('SETTINGS::MAIL:MAILER') != null) ?: 'smtp'); + $this->migrator->add('mail.mail_enabled', true); + } + + public function getOldValue(string $key) + { + if (DB::table('settings_old')->exists()) { + return DB::table('settings_old')->where('key', '=', $key)->get(['value']); + } + + return null; + } +} \ No newline at end of file diff --git a/database/settings/2023_02_01_181925_create_user_settings.php b/database/settings/2023_02_01_181925_create_user_settings.php new file mode 100644 index 00000000..48cdb353 --- /dev/null +++ b/database/settings/2023_02_01_181925_create_user_settings.php @@ -0,0 +1,31 @@ +migrator->add('user.credits_reward_after_verify_discord', ($this->getOldValue('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD') != null) ?: 250); + $this->migrator->add('user.credits_reward_after_verify_email', ($this->getOldValue('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL') != null) ?: 250); + $this->migrator->add('user.force_discord_verification', ($this->getOldValue('SETTINGS::USER:FORCE_DISCORD_VERIFICATION') != null) ?: false); + $this->migrator->add('user.force_email_verification', ($this->getOldValue('SETTINGS::USER:FORCE_EMAIL_VERIFICATION') != null) ?: false); + $this->migrator->add('user.initial_credits', ($this->getOldValue('SETTINGS::USER:INITIAL_CREDITS') != null) ?: 250); + $this->migrator->add('user.initial_server_limit', ($this->getOldValue('SETTINGS::USER:INITIAL_SERVER_LIMIT') != null) ?: 1); + $this->migrator->add('user.min_credits_to_make_server', ($this->getOldValue('SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER') != null) ?: 50); + $this->migrator->add('user.server_limit_after_irl_purchase', ($this->getOldValue('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') != null) ?: 10); + $this->migrator->add('user.server_limit_after_verify_discord', ($this->getOldValue('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') != null) ?: 2); + $this->migrator->add('user.server_limit_after_verify_email', ($this->getOldValue('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') != null) ?: 2); + } + + public function getOldValue(string $key) + { + if (DB::table('settings_old')->exists()) { + return DB::table('settings_old')->where('key', '=', $key)->get(['value']); + } + + return null; + } +} \ No newline at end of file diff --git a/database/settings/2023_02_01_181950_create_server_settings.php b/database/settings/2023_02_01_181950_create_server_settings.php new file mode 100644 index 00000000..354a93ec --- /dev/null +++ b/database/settings/2023_02_01_181950_create_server_settings.php @@ -0,0 +1,22 @@ +migrator->add('server.allocation_limit', ($this->getOldValue('SETTINGS::SERVER:ALLOCATION_LIMIT') != null) ?: 200); + } + + public function getOldValue(string $key) + { + if (DB::table('settings_old')->exists()) { + return DB::table('settings_old')->where('key', '=', $key)->get(['value']); + } + + return null; + } +} \ No newline at end of file diff --git a/database/settings/2023_02_01_182021_create_invoice_settings.php b/database/settings/2023_02_01_182021_create_invoice_settings.php new file mode 100644 index 00000000..0630495e --- /dev/null +++ b/database/settings/2023_02_01_182021_create_invoice_settings.php @@ -0,0 +1,29 @@ +migrator->add('invoice.company_address', ($this->getOldValue('SETTINGS::INVOICE:COMPANY_ADDRESS') != null) ?: null); + $this->migrator->add('invoice.company_mail', ($this->getOldValue('SETTINGS::INVOICE:COMPANY_MAIL') != null) ?: null); + $this->migrator->add('invoice.company_name', ($this->getOldValue('SETTINGS::INVOICE:COMPANY_NAME') != null) ?: null); + $this->migrator->add('invoice.company_phone', ($this->getOldValue('SETTINGS::INVOICE:COMPANY_PHONE') != null) ?: null); + $this->migrator->add('invoice.company_vat', ($this->getOldValue('SETTINGS::INVOICE:COMPANY_VAT') != null) ?: null); + $this->migrator->add('invoice.company_website', ($this->getOldValue('SETTINGS::INVOICE:COMPANY_WEBSITE') != null) ?: null); + $this->migrator->add('invoice.enabled', ($this->getOldValue('SETTINGS::INVOICE:ENABLED') != null) ?: true); + $this->migrator->add('invoice.prefix', ($this->getOldValue('SETTINGS::INVOICE:PREFIX') != null) ?: 'INV'); + } + + public function getOldValue(string $key) + { + if (DB::table('settings_old')->exists()) { + return DB::table('settings_old')->where('key', '=', $key)->get(['value']); + } + + return null; + } +} \ No newline at end of file diff --git a/database/settings/2023_02_01_182043_create_discord_settings.php b/database/settings/2023_02_01_182043_create_discord_settings.php new file mode 100644 index 00000000..34f06141 --- /dev/null +++ b/database/settings/2023_02_01_182043_create_discord_settings.php @@ -0,0 +1,27 @@ +migrator->add('discord.bot_token', ($this->getOldValue('SETTINGS::DISCORD:BOT_TOKEN') != null) ?: null); + $this->migrator->add('discord.client_id', ($this->getOldValue('SETTINGS::DISCORD:CLIENT_ID') != null) ?: null); + $this->migrator->add('discord.client_secret', ($this->getOldValue('SETTINGS::DISCORD:CLIENT_SECRET') != null) ?: null); + $this->migrator->add('discord.guild_id', ($this->getOldValue('SETTINGS::DISCORD:GUILD_ID') != null) ?: null); + $this->migrator->add('discord.invite_url', ($this->getOldValue('SETTINGS::DISCORD:INVITE_URL') != null) ?: null); + $this->migrator->add('discord.role_id', ($this->getOldValue('SETTINGS::DISCORD:ROLE_ID') != null) ?: null); + } + + public function getOldValue(string $key) + { + if (DB::table('settings_old')->exists()) { + return DB::table('settings_old')->where('key', '=', $key)->get(['value']); + } + + return null; + } +} \ No newline at end of file diff --git a/database/settings/2023_02_01_182108_create_locale_settings.php b/database/settings/2023_02_01_182108_create_locale_settings.php new file mode 100644 index 00000000..49c833c7 --- /dev/null +++ b/database/settings/2023_02_01_182108_create_locale_settings.php @@ -0,0 +1,26 @@ +migrator->add('locale.available', ($this->getOldValue('SETTINGS::LOCALE:AVAILABLE') != null) ?: ''); + $this->migrator->add('locale.clients_can_change', ($this->getOldValue('SETTINGS::LOCALE:CLIENTS_CAN_CHANGE') != null) ?: true); + $this->migrator->add('locale.datatables', ($this->getOldValue('SETTINGS::LOCALE:DATATABLES') != null) ?: 'en-gb'); + $this->migrator->add('locale.default', ($this->getOldValue('SETTINGS::LOCALE:DEFAULT') != null) ?: 'en'); + $this->migrator->add('locale.dynamic', ($this->getOldValue('SETTINGS::LOCALE:DYNAMIC') != null) ?: false); + } + + public function getOldValue(string $key) + { + if (DB::table('settings_old')->exists()) { + return DB::table('settings_old')->where('key', '=', $key)->get(['value']); + } + + return null; + } +} \ No newline at end of file diff --git a/database/settings/2023_02_01_182135_create_referral_settings.php b/database/settings/2023_02_01_182135_create_referral_settings.php new file mode 100644 index 00000000..6d305604 --- /dev/null +++ b/database/settings/2023_02_01_182135_create_referral_settings.php @@ -0,0 +1,27 @@ +migrator->add('referral.allowed', ($this->getOldValue('SETTINGS::REFERRAL::ALLOWED') != null) ?: 'client'); + $this->migrator->add('referral.always_give_commission', ($this->getOldValue('SETTINGS::REFERRAL::ALWAYS_GIVE_COMMISSION') != null) ?: false); + $this->migrator->add('referral.enabled', ($this->getOldValue('SETTINGS::REFERRAL::ENABLED') != null) ?: false); + $this->migrator->add('referral.reward', ($this->getOldValue('SETTINGS::REFERRAL::REWARD') != null) ?: 100); + $this->migrator->add('referral.mode', ($this->getOldValue('SETTINGS::REFERRAL:MODE') != null) ?: 'sign-up'); + $this->migrator->add('referral.percentage', ($this->getOldValue('SETTINGS::REFERRAL:PERCENTAGE') != null) ?: 100); + } + + public function getOldValue(string $key) + { + if (DB::table('settings_old')->exists()) { + return DB::table('settings_old')->where('key', '=', $key)->get(['value']); + } + + return null; + } +} \ No newline at end of file diff --git a/database/settings/2023_02_01_182158_create_website_settings.php b/database/settings/2023_02_01_182158_create_website_settings.php new file mode 100644 index 00000000..d164c3b4 --- /dev/null +++ b/database/settings/2023_02_01_182158_create_website_settings.php @@ -0,0 +1,22 @@ +migrator->add('website.', ($this->getOldValue('SETTINGS::') != null) ?: ''); + } + + public function getOldValue(string $key) + { + if (DB::table('settings_old')->exists()) { + return DB::table('settings_old')->where('key', '=', $key)->get(['value']); + } + + return null; + } +} \ No newline at end of file