fix: 🐛 Use groups on getNewValue method

This commit is contained in:
IceToast 2024-04-12 21:01:49 +02:00
parent 330ea45c5b
commit 38cf81d92d
13 changed files with 196 additions and 147 deletions

View file

@ -26,7 +26,7 @@ class UpdateUserCreditsDatatype extends Migration
public function down() public function down()
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->decimal('price', ['11', '2'])->change(); $table->decimal('credits', ['11', '2'])->change();
}); });
} }
} }

View file

@ -27,70 +27,73 @@ class CreateGeneralSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME', 'key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME',
'value' => $this->getNewValue('credits_display_name'), 'value' => $this->getNewValue('credits_display_name', 'general'),
'type' => 'string', 'type' => 'string',
'description' => 'The name of the credits on the panel.' 'description' => 'The name of the credits on the panel.'
], ],
[ [
'key' => 'SETTINGS::SYSTEM:ALERT_ENABLED', 'key' => 'SETTINGS::SYSTEM:ALERT_ENABLED',
'value' => $this->getNewValue('alert_enabled'), 'value' => $this->getNewValue('alert_enabled', 'general'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Enable the alert at the top of the panel.' 'description' => 'Enable the alert at the top of the panel.'
], ],
[ [
'key' => 'SETTINGS::SYSTEM:ALERT_TYPE', 'key' => 'SETTINGS::SYSTEM:ALERT_TYPE',
'value' => $this->getNewValue('alert_type'), 'value' => $this->getNewValue('alert_type', 'general'),
'type' => 'string', 'type' => 'string',
'description' => 'The type of alert to display.' 'description' => 'The type of alert to display.'
], ],
[ [
'key' => 'SETTINGS::SYSTEM:ALERT_MESSAGE', 'key' => 'SETTINGS::SYSTEM:ALERT_MESSAGE',
'value' => $this->getNewValue('alert_message'), 'value' => $this->getNewValue('alert_message', 'general'),
'type' => 'text', 'type' => 'text',
'description' => 'The message to display in the alert.' 'description' => 'The message to display in the alert.'
], ],
[ [
'key' => 'SETTINGS::SYSTEM:THEME', 'key' => 'SETTINGS::SYSTEM:THEME',
'value' => $this->getNewValue('theme'), 'value' => $this->getNewValue('theme', 'general'),
'type' => 'string', 'type' => 'string',
'description' => 'The theme to use for the panel.' 'description' => 'The theme to use for the panel.'
], ],
[ [
'key' => 'SETTINGS::RECAPTCHA:SITE_KEY', 'key' => 'SETTINGS::RECAPTCHA:SITE_KEY',
'value' => $this->getNewValue('recaptcha_site_key'), 'value' => $this->getNewValue('recaptcha_site_key', 'general'),
'type' => 'string', 'type' => 'string',
'description' => 'The site key for reCAPTCHA.' 'description' => 'The site key for reCAPTCHA.'
], ],
[ [
'key' => 'SETTINGS::RECAPTCHA:SECRET_KEY', 'key' => 'SETTINGS::RECAPTCHA:SECRET_KEY',
'value' => $this->getNewValue('recaptcha_secret_key'), 'value' => $this->getNewValue('recaptcha_secret_key', 'general'),
'type' => 'string', 'type' => 'string',
'description' => 'The secret key for reCAPTCHA.' 'description' => 'The secret key for reCAPTCHA.'
], ],
[ [
'key' => 'SETTINGS::RECAPTCHA:ENABLED', 'key' => 'SETTINGS::RECAPTCHA:ENABLED',
'value' => $this->getNewValue('recaptcha_enabled'), 'value' => $this->getNewValue('recaptcha_enabled', 'general'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Enable reCAPTCHA on the panel.' 'description' => 'Enable reCAPTCHA on the panel.'
], ],
[ [
'key' => 'SETTINGS::MISC:PHPMYADMIN:URL', 'key' => 'SETTINGS::MISC:PHPMYADMIN:URL',
'value' => $this->getNewValue('phpmyadmin_url'), 'value' => $this->getNewValue('phpmyadmin_url', 'general'),
'type' => 'string', 'type' => 'string',
'description' => 'The URL to your phpMyAdmin installation.' 'description' => 'The URL to your phpMyAdmin installation.'
], ],
]); ]);
try {
$this->migrator->delete('general.store_enabled'); $this->migrator->delete('general.store_enabled');
$this->migrator->delete('general.credits_display_name'); $this->migrator->delete('general.credits_display_name');
$this->migrator->delete('general.recaptcha_site_key'); $this->migrator->delete('general.recaptcha_site_key');
$this->migrator->delete('general.recaptcha_secret_key'); $this->migrator->delete('general.recaptcha_secret_key');
$this->migrator->delete('general.recaptcha_enabled'); $this->migrator->delete('general.recaptcha_enabled');
$this->migrator->delete('general.phpmyadmin_url'); $this->migrator->delete('general.phpmyadmin_url');
$this->migrator->delete('general.alert_enabled'); $this->migrator->delete('general.alert_enabled');
$this->migrator->delete('general.alert_type'); $this->migrator->delete('general.alert_type');
$this->migrator->delete('general.alert_message'); $this->migrator->delete('general.alert_message');
$this->migrator->delete('general.theme'); $this->migrator->delete('general.theme');
} catch (Exception $e) {
// Do nothing
}
} }
} }

View file

@ -24,33 +24,37 @@ class CreatePterodactylSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN', 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN',
'value' => $this->getNewValue('admin_token'), 'value' => $this->getNewValue('admin_token', 'pterodactyl'),
'type' => 'string', 'type' => 'string',
'description' => 'The admin token for the Pterodactyl panel.', 'description' => 'The admin token for the Pterodactyl panel.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN', 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN',
'value' => $this->getNewValue('user_token'), 'value' => $this->getNewValue('user_token', 'pterodactyl'),
'type' => 'string', 'type' => 'string',
'description' => 'The user token for the Pterodactyl panel.', 'description' => 'The user token for the Pterodactyl panel.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:PTERODACTYL:URL', 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:URL',
'value' => $this->getNewValue('panel_url'), 'value' => $this->getNewValue('panel_url', 'pterodactyl'),
'type' => 'string', 'type' => 'string',
'description' => 'The URL for the Pterodactyl panel.', 'description' => 'The URL for the Pterodactyl panel.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT', 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT',
'value' => $this->getNewValue('per_page_limit'), 'value' => $this->getNewValue('per_page_limit', 'pterodactyl'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The number of servers to show per page.', 'description' => 'The number of servers to show per page.',
], ],
]); ]);
$this->migrator->delete('pterodactyl.admin_token'); try {
$this->migrator->delete('pterodactyl.user_token'); $this->migrator->delete('pterodactyl.admin_token');
$this->migrator->delete('pterodactyl.panel_url'); $this->migrator->delete('pterodactyl.user_token');
$this->migrator->delete('pterodactyl.per_page_limit'); $this->migrator->delete('pterodactyl.panel_url');
$this->migrator->delete('pterodactyl.per_page_limit');
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
} }
} }

View file

@ -25,62 +25,66 @@ class CreateMailSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::MAIL:HOST', 'key' => 'SETTINGS::MAIL:HOST',
'value' => $this->getNewValue('mail_host'), 'value' => $this->getNewValue('mail_host', 'mail'),
'type' => 'string', 'type' => 'string',
'description' => 'The host of the mail server.', 'description' => 'The host of the mail server.',
], ],
[ [
'key' => 'SETTINGS::MAIL:PORT', 'key' => 'SETTINGS::MAIL:PORT',
'value' => $this->getNewValue('mail_port'), 'value' => $this->getNewValue('mail_port', 'mail'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The port of the mail server.', 'description' => 'The port of the mail server.',
], ],
[ [
'key' => 'SETTINGS::MAIL:USERNAME', 'key' => 'SETTINGS::MAIL:USERNAME',
'value' => $this->getNewValue('mail_username'), 'value' => $this->getNewValue('mail_username', 'mail'),
'type' => 'string', 'type' => 'string',
'description' => 'The username of the mail server.', 'description' => 'The username of the mail server.',
], ],
[ [
'key' => 'SETTINGS::MAIL:PASSWORD', 'key' => 'SETTINGS::MAIL:PASSWORD',
'value' => $this->getNewValue('mail_password'), 'value' => $this->getNewValue('mail_password', 'mail'),
'type' => 'string', 'type' => 'string',
'description' => 'The password of the mail server.', 'description' => 'The password of the mail server.',
], ],
[ [
'key' => 'SETTINGS::MAIL:ENCRYPTION', 'key' => 'SETTINGS::MAIL:ENCRYPTION',
'value' => $this->getNewValue('mail_encryption'), 'value' => $this->getNewValue('mail_encryption', 'mail'),
'type' => 'string', 'type' => 'string',
'description' => 'The encryption of the mail server.', 'description' => 'The encryption of the mail server.',
], ],
[ [
'key' => 'SETTINGS::MAIL:FROM_ADDRESS', 'key' => 'SETTINGS::MAIL:FROM_ADDRESS',
'value' => $this->getNewValue('mail_from_address'), 'value' => $this->getNewValue('mail_from_address', 'mail'),
'type' => 'string', 'type' => 'string',
'description' => 'The from address of the mail server.', 'description' => 'The from address of the mail server.',
], ],
[ [
'key' => 'SETTINGS::MAIL:FROM_NAME', 'key' => 'SETTINGS::MAIL:FROM_NAME',
'value' => $this->getNewValue('mail_from_name'), 'value' => $this->getNewValue('mail_from_name', 'mail'),
'type' => 'string', 'type' => 'string',
'description' => 'The from name of the mail server.', 'description' => 'The from name of the mail server.',
], ],
[ [
'key' => 'SETTINGS::MAIL:MAILER', 'key' => 'SETTINGS::MAIL:MAILER',
'value' => $this->getNewValue('mail_mailer'), 'value' => $this->getNewValue('mail_mailer', 'mail'),
'type' => 'string', 'type' => 'string',
'description' => 'The mailer of the mail server.', 'description' => 'The mailer of the mail server.',
], ],
]); ]);
$this->migrator->delete('mail.mail_host'); try {
$this->migrator->delete('mail.mail_port'); $this->migrator->delete('mail.mail_host');
$this->migrator->delete('mail.mail_username'); $this->migrator->delete('mail.mail_port');
$this->migrator->delete('mail.mail_password'); $this->migrator->delete('mail.mail_username');
$this->migrator->delete('mail.mail_encryption'); $this->migrator->delete('mail.mail_password');
$this->migrator->delete('mail.mail_from_address'); $this->migrator->delete('mail.mail_encryption');
$this->migrator->delete('mail.mail_from_name'); $this->migrator->delete('mail.mail_from_address');
$this->migrator->delete('mail.mail_mailer'); $this->migrator->delete('mail.mail_from_name');
$this->migrator->delete('mail.mail_mailer');
} catch (Exception $e) {
//
}
} }
} }

View file

@ -29,92 +29,96 @@ class CreateUserSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD', 'key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD',
'value' => $this->getNewValue('credits_reward_after_verify_discord'), 'value' => $this->getNewValue('credits_reward_after_verify_discord', 'user'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The amount of credits that the user will receive after verifying their Discord account.', 'description' => 'The amount of credits that the user will receive after verifying their Discord account.',
], ],
[ [
'key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL', 'key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL',
'value' => $this->getNewValue('credits_reward_after_verify_email'), 'value' => $this->getNewValue('credits_reward_after_verify_email', 'user'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The amount of credits that the user will receive after verifying their email.', 'description' => 'The amount of credits that the user will receive after verifying their email.',
], ],
[ [
'key' => 'SETTINGS::USER:FORCE_DISCORD_VERIFICATION', 'key' => 'SETTINGS::USER:FORCE_DISCORD_VERIFICATION',
'value' => $this->getNewValue('force_discord_verification'), 'value' => $this->getNewValue('force_discord_verification', 'user'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'If the user must verify their Discord account to use the panel.', 'description' => 'If the user must verify their Discord account to use the panel.',
], ],
[ [
'key' => 'SETTINGS::USER:FORCE_EMAIL_VERIFICATION', 'key' => 'SETTINGS::USER:FORCE_EMAIL_VERIFICATION',
'value' => $this->getNewValue('force_email_verification'), 'value' => $this->getNewValue('force_email_verification', 'user'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'If the user must verify their email to use the panel.', 'description' => 'If the user must verify their email to use the panel.',
], ],
[ [
'key' => 'SETTINGS::USER:INITIAL_CREDITS', 'key' => 'SETTINGS::USER:INITIAL_CREDITS',
'value' => $this->getNewValue('initial_credits'), 'value' => $this->getNewValue('initial_credits', 'user'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The amount of credits that the user will receive when they register.', 'description' => 'The amount of credits that the user will receive when they register.',
], ],
[ [
'key' => 'SETTINGS::USER:INITIAL_SERVER_LIMIT', 'key' => 'SETTINGS::USER:INITIAL_SERVER_LIMIT',
'value' => $this->getNewValue('initial_server_limit'), 'value' => $this->getNewValue('initial_server_limit', 'user'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The amount of servers that the user will be able to create when they register.', 'description' => 'The amount of servers that the user will be able to create when they register.',
], ],
[ [
'key' => 'SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', 'key' => 'SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER',
'value' => $this->getNewValue('min_credits_to_make_server'), 'value' => $this->getNewValue('min_credits_to_make_server', 'user'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The minimum amount of credits that the user must have to create a server.', 'description' => 'The minimum amount of credits that the user must have to create a server.',
], ],
[ [
'key' => 'SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE', 'key' => 'SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE',
'value' => $this->getNewValue('server_limit_after_irl_purchase'), 'value' => $this->getNewValue('server_limit_after_irl_purchase', 'user'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The amount of servers that the user will be able to create after making a real purchase.', 'description' => 'The amount of servers that the user will be able to create after making a real purchase.',
], ],
[ [
'key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD', 'key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD',
'value' => $this->getNewValue('server_limit_after_verify_discord'), 'value' => $this->getNewValue('server_limit_after_verify_discord', 'user'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The amount of servers that the user will be able to create after verifying their Discord account.', 'description' => 'The amount of servers that the user will be able to create after verifying their Discord account.',
], ],
[ [
'key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL', 'key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL',
'value' => $this->getNewValue('server_limit_after_verify_email'), 'value' => $this->getNewValue('server_limit_after_verify_email', 'user'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The amount of servers that the user will be able to create after verifying their email.', 'description' => 'The amount of servers that the user will be able to create after verifying their email.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:REGISTER_IP_CHECK', 'key' => 'SETTINGS::SYSTEM:REGISTER_IP_CHECK',
'value' => $this->getNewValue('register_ip_check'), 'value' => $this->getNewValue('register_ip_check', 'user'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'If the user must verify their IP address to register.', 'description' => 'If the user must verify their IP address to register.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:CREATION_OF_NEW_USERS', 'key' => 'SETTINGS::SYSTEM:CREATION_OF_NEW_USERS',
'value' => $this->getNewValue('creation_enabled'), 'value' => $this->getNewValue('creation_enabled', 'user'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'If the user can register.', 'description' => 'If the user can register.',
], ],
]); ]);
$this->migrator->delete('user.credits_reward_after_verify_discord'); try {
$this->migrator->delete('user.credits_reward_after_verify_email'); $this->migrator->delete('user.credits_reward_after_verify_discord');
$this->migrator->delete('user.force_discord_verification'); $this->migrator->delete('user.credits_reward_after_verify_email');
$this->migrator->delete('user.force_email_verification'); $this->migrator->delete('user.force_discord_verification');
$this->migrator->delete('user.initial_credits'); $this->migrator->delete('user.force_email_verification');
$this->migrator->delete('user.initial_server_limit'); $this->migrator->delete('user.initial_credits');
$this->migrator->delete('user.min_credits_to_make_server'); $this->migrator->delete('user.initial_server_limit');
$this->migrator->delete('user.server_limit_after_irl_purchase'); $this->migrator->delete('user.min_credits_to_make_server');
$this->migrator->delete('user.server_limit_after_verify_discord'); $this->migrator->delete('user.server_limit_after_irl_purchase');
$this->migrator->delete('user.server_limit_after_verify_email'); $this->migrator->delete('user.server_limit_after_verify_discord');
$this->migrator->delete('user.register_ip_check'); $this->migrator->delete('user.server_limit_after_verify_email');
$this->migrator->delete('user.creation_enabled'); $this->migrator->delete('user.register_ip_check');
$this->migrator->delete('user.creation_enabled');
} catch (Exception $e) {
// Do nothing
}
} }
} }

View file

@ -20,26 +20,30 @@ class CreateServerSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::SERVER:ALLOCATION_LIMIT', 'key' => 'SETTINGS::SERVER:ALLOCATION_LIMIT',
'value' => $this->getNewValue('allocation_limit'), 'value' => $this->getNewValue('allocation_limit', 'server'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The number of servers to show per page.', 'description' => 'The number of servers to show per page.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS', 'key' => 'SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS',
'value' => $this->getNewValue('creation_enabled'), 'value' => $this->getNewValue('creation_enabled', 'server'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Whether or not users can create new servers.', 'description' => 'Whether or not users can create new servers.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:ENABLE_UPGRADE', 'key' => 'SETTINGS::SYSTEM:ENABLE_UPGRADE',
'value' => $this->getNewValue('enable_upgrade'), 'value' => $this->getNewValue('enable_upgrade', 'server'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Whether or not users can upgrade their servers.', 'description' => 'Whether or not users can upgrade their servers.',
], ],
]); ]);
$this->migrator->delete('server.allocation_limit'); try {
$this->migrator->delete('server.creation_enabled'); $this->migrator->delete('server.allocation_limit');
$this->migrator->delete('server.enable_upgrade'); $this->migrator->delete('server.creation_enabled');
$this->migrator->delete('server.enable_upgrade');
} catch (Exception $e) {
// Do nothing
}
} }
} }

View file

@ -25,61 +25,65 @@ class CreateInvoiceSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::INVOICE:COMPANY_ADDRESS', 'key' => 'SETTINGS::INVOICE:COMPANY_ADDRESS',
'value' => $this->getNewValue('company_address'), 'value' => $this->getNewValue('company_address', 'invoice'),
'type' => 'string', 'type' => 'string',
'description' => 'The address of the company.', 'description' => 'The address of the company.',
], ],
[ [
'key' => 'SETTINGS::INVOICE:COMPANY_MAIL', 'key' => 'SETTINGS::INVOICE:COMPANY_MAIL',
'value' => $this->getNewValue('company_mail'), 'value' => $this->getNewValue('company_mail', 'invoice'),
'type' => 'string', 'type' => 'string',
'description' => 'The email address of the company.', 'description' => 'The email address of the company.',
], ],
[ [
'key' => 'SETTINGS::INVOICE:COMPANY_NAME', 'key' => 'SETTINGS::INVOICE:COMPANY_NAME',
'value' => $this->getNewValue('company_name'), 'value' => $this->getNewValue('company_name', 'invoice'),
'type' => 'string', 'type' => 'string',
'description' => 'The name of the company.', 'description' => 'The name of the company.',
], ],
[ [
'key' => 'SETTINGS::INVOICE:COMPANY_PHONE', 'key' => 'SETTINGS::INVOICE:COMPANY_PHONE',
'value' => $this->getNewValue('company_phone'), 'value' => $this->getNewValue('company_phone', 'invoice'),
'type' => 'string', 'type' => 'string',
'description' => 'The phone number of the company.', 'description' => 'The phone number of the company.',
], ],
[ [
'key' => 'SETTINGS::INVOICE:COMPANY_VAT', 'key' => 'SETTINGS::INVOICE:COMPANY_VAT',
'value' => $this->getNewValue('company_vat'), 'value' => $this->getNewValue('company_vat', 'invoice'),
'type' => 'string', 'type' => 'string',
'description' => 'The VAT number of the company.', 'description' => 'The VAT number of the company.',
], ],
[ [
'key' => 'SETTINGS::INVOICE:COMPANY_WEBSITE', 'key' => 'SETTINGS::INVOICE:COMPANY_WEBSITE',
'value' => $this->getNewValue('company_website'), 'value' => $this->getNewValue('company_website', 'invoice'),
'type' => 'string', 'type' => 'string',
'description' => 'The website of the company.', 'description' => 'The website of the company.',
], ],
[ [
'key' => 'SETTINGS::INVOICE:ENABLED', 'key' => 'SETTINGS::INVOICE:ENABLED',
'value' => $this->getNewValue('enabled'), 'value' => $this->getNewValue('enabled', 'invoice'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Enable or disable the invoice system.', 'description' => 'Enable or disable the invoice system.',
], ],
[ [
'key' => 'SETTINGS::INVOICE:PREFIX', 'key' => 'SETTINGS::INVOICE:PREFIX',
'value' => $this->getNewValue('prefix'), 'value' => $this->getNewValue('prefix', 'invoice'),
'type' => 'string', 'type' => 'string',
'description' => 'The prefix of the invoice.', 'description' => 'The prefix of the invoice.',
], ],
]); ]);
$this->migrator->delete('invoice.company_address'); try {
$this->migrator->delete('invoice.company_mail'); $this->migrator->delete('invoice.company_address');
$this->migrator->delete('invoice.company_name'); $this->migrator->delete('invoice.company_mail');
$this->migrator->delete('invoice.company_phone'); $this->migrator->delete('invoice.company_name');
$this->migrator->delete('invoice.company_vat'); $this->migrator->delete('invoice.company_phone');
$this->migrator->delete('invoice.company_website'); $this->migrator->delete('invoice.company_vat');
$this->migrator->delete('invoice.enabled'); $this->migrator->delete('invoice.company_website');
$this->migrator->delete('invoice.prefix'); $this->migrator->delete('invoice.enabled');
$this->migrator->delete('invoice.prefix');
} catch (Exception $e) {
// Do nothing
}
} }
} }

View file

@ -23,48 +23,52 @@ class CreateDiscordSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::DISCORD:BOT_TOKEN', 'key' => 'SETTINGS::DISCORD:BOT_TOKEN',
'value' => $this->getNewValue('bot_token'), 'value' => $this->getNewValue('bot_token', 'discord'),
'type' => 'string', 'type' => 'string',
'description' => 'The bot token for the Discord bot.', 'description' => 'The bot token for the Discord bot.',
], ],
[ [
'key' => 'SETTINGS::DISCORD:CLIENT_ID', 'key' => 'SETTINGS::DISCORD:CLIENT_ID',
'value' => $this->getNewValue('client_id'), 'value' => $this->getNewValue('client_id', 'discord'),
'type' => 'string', 'type' => 'string',
'description' => 'The client ID for the Discord bot.', 'description' => 'The client ID for the Discord bot.',
], ],
[ [
'key' => 'SETTINGS::DISCORD:CLIENT_SECRET', 'key' => 'SETTINGS::DISCORD:CLIENT_SECRET',
'value' => $this->getNewValue('client_secret'), 'value' => $this->getNewValue('client_secret', 'discord'),
'type' => 'string', 'type' => 'string',
'description' => 'The client secret for the Discord bot.', 'description' => 'The client secret for the Discord bot.',
], ],
[ [
'key' => 'SETTINGS::DISCORD:GUILD_ID', 'key' => 'SETTINGS::DISCORD:GUILD_ID',
'value' => $this->getNewValue('guild_id'), 'value' => $this->getNewValue('guild_id', 'discord'),
'type' => 'string', 'type' => 'string',
'description' => 'The guild ID for the Discord bot.', 'description' => 'The guild ID for the Discord bot.',
], ],
[ [
'key' => 'SETTINGS::DISCORD:INVITE_URL', 'key' => 'SETTINGS::DISCORD:INVITE_URL',
'value' => $this->getNewValue('invite_url'), 'value' => $this->getNewValue('invite_url', 'discord'),
'type' => 'string', 'type' => 'string',
'description' => 'The invite URL for the Discord bot.', 'description' => 'The invite URL for the Discord bot.',
], ],
[ [
'key' => 'SETTINGS::DISCORD:ROLE_ID', 'key' => 'SETTINGS::DISCORD:ROLE_ID',
'value' => $this->getNewValue('role_id'), 'value' => $this->getNewValue('role_id', 'discord'),
'type' => 'string', 'type' => 'string',
'description' => 'The role ID for the Discord bot.', 'description' => 'The role ID for the Discord bot.',
] ]
]); ]);
$this->migrator->delete('discord.bot_token'); try {
$this->migrator->delete('discord.client_id'); $this->migrator->delete('discord.bot_token');
$this->migrator->delete('discord.client_secret'); $this->migrator->delete('discord.client_id');
$this->migrator->delete('discord.guild_id'); $this->migrator->delete('discord.client_secret');
$this->migrator->delete('discord.invite_url'); $this->migrator->delete('discord.guild_id');
$this->migrator->delete('discord.role_id'); $this->migrator->delete('discord.invite_url');
$this->migrator->delete('discord.role_id');
} catch (Exception $e) {
// Do nothing.
}
} }
} }

View file

@ -22,40 +22,44 @@ class CreateLocaleSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::LOCALE:AVAILABLE', 'key' => 'SETTINGS::LOCALE:AVAILABLE',
'value' => $this->getNewValue('available'), 'value' => $this->getNewValue('available', 'locale'),
'type' => 'string', 'type' => 'string',
'description' => 'The available locales.', 'description' => 'The available locales.',
], ],
[ [
'key' => 'SETTINGS::LOCALE:CLIENTS_CAN_CHANGE', 'key' => 'SETTINGS::LOCALE:CLIENTS_CAN_CHANGE',
'value' => $this->getNewValue('clients_can_change'), 'value' => $this->getNewValue('clients_can_change', 'locale'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'If clients can change their locale.', 'description' => 'If clients can change their locale.',
], ],
[ [
'key' => 'SETTINGS::LOCALE:DATATABLES', 'key' => 'SETTINGS::LOCALE:DATATABLES',
'value' => $this->getNewValue('datatables'), 'value' => $this->getNewValue('datatables', 'locale'),
'type' => 'string', 'type' => 'string',
'description' => 'The locale for datatables.', 'description' => 'The locale for datatables.',
], ],
[ [
'key' => 'SETTINGS::LOCALE:DEFAULT', 'key' => 'SETTINGS::LOCALE:DEFAULT',
'value' => $this->getNewValue('default'), 'value' => $this->getNewValue('default', 'locale'),
'type' => 'string', 'type' => 'string',
'description' => 'The default locale.', 'description' => 'The default locale.',
], ],
[ [
'key' => 'SETTINGS::LOCALE:DYNAMIC', 'key' => 'SETTINGS::LOCALE:DYNAMIC',
'value' => $this->getNewValue('dynamic'), 'value' => $this->getNewValue('dynamic', 'locale'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'If the locale should be dynamic.', 'description' => 'If the locale should be dynamic.',
], ],
]); ]);
$this->migrator->delete('locale.available'); try {
$this->migrator->delete('locale.clients_can_change'); $this->migrator->delete('locale.available');
$this->migrator->delete('locale.datatables'); $this->migrator->delete('locale.clients_can_change');
$this->migrator->delete('locale.default'); $this->migrator->delete('locale.datatables');
$this->migrator->delete('locale.dynamic'); $this->migrator->delete('locale.default');
$this->migrator->delete('locale.dynamic');
} catch (Exception $e) {
// Do nothing
}
} }
} }

View file

@ -22,47 +22,51 @@ class CreateReferralSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::REFERRAL::ALLOWED', 'key' => 'SETTINGS::REFERRAL::ALLOWED',
'value' => $this->getNewValue('allowed'), 'value' => $this->getNewValue('allowed', 'referral'),
'type' => 'string', 'type' => 'string',
'description' => 'The allowed referral types.', 'description' => 'The allowed referral types.',
], ],
[ [
'key' => 'SETTINGS::REFERRAL::ALWAYS_GIVE_COMMISSION', 'key' => 'SETTINGS::REFERRAL::ALWAYS_GIVE_COMMISSION',
'value' => $this->getNewValue('always_give_commission'), 'value' => $this->getNewValue('always_give_commission', 'referral'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Whether to always give commission to the referrer.', 'description' => 'Whether to always give commission to the referrer.',
], ],
[ [
'key' => 'SETTINGS::REFERRAL::ENABLED', 'key' => 'SETTINGS::REFERRAL::ENABLED',
'value' => $this->getNewValue('enabled'), 'value' => $this->getNewValue('enabled', 'referral'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Whether to enable the referral system.', 'description' => 'Whether to enable the referral system.',
], ],
[ [
'key' => 'SETTINGS::REFERRAL::REWARD', 'key' => 'SETTINGS::REFERRAL::REWARD',
'value' => $this->getNewValue('reward'), 'value' => $this->getNewValue('reward', 'referral'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The reward for the referral.', 'description' => 'The reward for the referral.',
], ],
[ [
'key' => 'SETTINGS::REFERRAL:MODE', 'key' => 'SETTINGS::REFERRAL:MODE',
'value' => $this->getNewValue('mode'), 'value' => $this->getNewValue('mode', 'referral'),
'type' => 'string', 'type' => 'string',
'description' => 'The referral mode.', 'description' => 'The referral mode.',
], ],
[ [
'key' => 'SETTINGS::REFERRAL:PERCENTAGE', 'key' => 'SETTINGS::REFERRAL:PERCENTAGE',
'value' => $this->getNewValue('percentage'), 'value' => $this->getNewValue('percentage', 'referral'),
'type' => 'integer', 'type' => 'integer',
'description' => 'The referral percentage.', 'description' => 'The referral percentage.',
], ],
]); ]);
$this->migrator->delete('referral.allowed'); try {
$this->migrator->delete('referral.always_give_commission'); $this->migrator->delete('referral.allowed');
$this->migrator->delete('referral.enabled'); $this->migrator->delete('referral.always_give_commission');
$this->migrator->delete('referral.reward'); $this->migrator->delete('referral.enabled');
$this->migrator->delete('referral.mode'); $this->migrator->delete('referral.reward');
$this->migrator->delete('referral.percentage'); $this->migrator->delete('referral.mode');
$this->migrator->delete('referral.percentage');
} catch (Exception $e) {
//
}
} }
} }

View file

@ -33,68 +33,72 @@ class CreateWebsiteSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::SYSTEM:MOTD_ENABLED', 'key' => 'SETTINGS::SYSTEM:MOTD_ENABLED',
'value' => $this->getNewValue('motd_enabled'), 'value' => $this->getNewValue('motd_enabled', 'website'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Enable or disable the MOTD.', 'description' => 'Enable or disable the MOTD.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:MOTD_MESSAGE', 'key' => 'SETTINGS::SYSTEM:MOTD_MESSAGE',
'value' => $this->getNewValue('motd_message'), 'value' => $this->getNewValue('motd_message', 'website'),
'type' => 'text', 'type' => 'text',
'description' => 'The message that will be displayed in the MOTD.', 'description' => 'The message that will be displayed in the MOTD.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:SHOW_IMPRINT', 'key' => 'SETTINGS::SYSTEM:SHOW_IMPRINT',
'value' => $this->getNewValue('show_imprint'), 'value' => $this->getNewValue('show_imprint', 'website'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Enable or disable the imprint.', 'description' => 'Enable or disable the imprint.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:SHOW_PRIVACY', 'key' => 'SETTINGS::SYSTEM:SHOW_PRIVACY',
'value' => $this->getNewValue('show_privacy'), 'value' => $this->getNewValue('show_privacy', 'website'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Enable or disable the privacy policy.', 'description' => 'Enable or disable the privacy policy.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:SHOW_TOS', 'key' => 'SETTINGS::SYSTEM:SHOW_TOS',
'value' => $this->getNewValue('show_tos'), 'value' => $this->getNewValue('show_tos', 'website'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Enable or disable the terms of service.', 'description' => 'Enable or disable the terms of service.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:USEFULLINKS_ENABLED', 'key' => 'SETTINGS::SYSTEM:USEFULLINKS_ENABLED',
'value' => $this->getNewValue('useful_links_enabled'), 'value' => $this->getNewValue('useful_links_enabled', 'website'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Enable or disable the useful links.', 'description' => 'Enable or disable the useful links.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:SEO_TITLE', 'key' => 'SETTINGS::SYSTEM:SEO_TITLE',
'value' => $this->getNewValue('seo_title'), 'value' => $this->getNewValue('seo_title', 'website'),
'type' => 'string', 'type' => 'string',
'description' => 'The title of the website.', 'description' => 'The title of the website.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:SEO_DESCRIPTION', 'key' => 'SETTINGS::SYSTEM:SEO_DESCRIPTION',
'value' => $this->getNewValue('seo_description'), 'value' => $this->getNewValue('seo_description', 'website'),
'type' => 'string', 'type' => 'string',
'description' => 'The description of the website.', 'description' => 'The description of the website.',
], ],
[ [
'key' => 'SETTINGS::SYSTEM:ENABLE_LOGIN_LOGO', 'key' => 'SETTINGS::SYSTEM:ENABLE_LOGIN_LOGO',
'value' => $this->getNewValue('enable_login_logo'), 'value' => $this->getNewValue('enable_login_logo', 'website'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Enable or disable the login logo.', 'description' => 'Enable or disable the login logo.',
] ]
]); ]);
$this->migrator->delete('website.motd_enabled'); try {
$this->migrator->delete('website.motd_message'); $this->migrator->delete('website.motd_enabled');
$this->migrator->delete('website.show_imprint'); $this->migrator->delete('website.motd_message');
$this->migrator->delete('website.show_privacy'); $this->migrator->delete('website.show_imprint');
$this->migrator->delete('website.show_tos'); $this->migrator->delete('website.show_privacy');
$this->migrator->delete('website.useful_links_enabled'); $this->migrator->delete('website.show_tos');
$this->migrator->delete('website.seo_title'); $this->migrator->delete('website.useful_links_enabled');
$this->migrator->delete('website.seo_description'); $this->migrator->delete('website.seo_title');
$this->migrator->delete('website.enable_login_logo'); $this->migrator->delete('website.seo_description');
$this->migrator->delete('website.enable_login_logo');
} catch (Exception $e) {
// Do nothing
}
} }
} }

View file

@ -19,19 +19,23 @@ class CreateTicketSettings extends LegacySettingsMigration
DB::table('settings_old')->insert([ DB::table('settings_old')->insert([
[ [
'key' => 'SETTINGS::TICKET:NOTIFY', 'key' => 'SETTINGS::TICKET:NOTIFY',
'value' => $this->getNewValue('notify'), 'value' => $this->getNewValue('notify', 'ticket'),
'type' => 'string', 'type' => 'string',
'description' => 'The notification type for tickets.', 'description' => 'The notification type for tickets.',
], ],
[ [
'key' => 'SETTINGS::TICKET:ENABLED', 'key' => 'SETTINGS::TICKET:ENABLED',
'value' => $this->getNewValue('enabled'), 'value' => $this->getNewValue('enabled', 'ticket'),
'type' => 'boolean', 'type' => 'boolean',
'description' => 'Enable or disable the ticket system.', 'description' => 'Enable or disable the ticket system.',
] ]
]); ]);
$this->migrator->delete('ticket.enabled'); try {
$this->migrator->delete('ticket.notify'); $this->migrator->delete('ticket.enabled');
$this->migrator->delete('ticket.notify');
} catch (Exception $e) {
// Do nothing.
}
} }
} }

View file

@ -9,4 +9,10 @@ return new class extends SettingsMigration
$this->migrator->delete('ticket.notify'); $this->migrator->delete('ticket.notify');
$this->migrator->add('ticket.information', "Can't start your server? Need an additional port? Do you have any other questions? Let us know by opening a ticket."); $this->migrator->add('ticket.information', "Can't start your server? Need an additional port? Do you have any other questions? Let us know by opening a ticket.");
} }
public function down(): void
{
$this->migrator->add('ticket.notify', 'all');
$this->migrator->delete('ticket.information');
}
}; };