Browse Source

fix: 🚚 Move and remove some settings

IceToast 2 years ago
parent
commit
b97bc8edf7

+ 1 - 1
app/Settings/InvoiceSettings.php

@@ -6,13 +6,13 @@ use Spatie\LaravelSettings\Settings;
 
 class InvoiceSettings extends Settings
 {
+    public bool $enabled;
     public ?string $company_address;
     public ?string $company_mail;
     public ?string $company_name;
     public ?string $company_phone;
     public ?string $company_vat;
     public ?string $company_website;
-    public bool $enabled;
     public ?string $prefix;
 
     public static function group(): string

+ 0 - 6
app/Settings/MailSettings.php

@@ -14,7 +14,6 @@ class MailSettings extends Settings
     public ?string $mail_from_address;
     public ?string $mail_from_name;
     public ?string $mail_mailer;
-    public bool $mail_enabled;
 
     public static function group(): string
     {
@@ -52,7 +51,6 @@ class MailSettings extends Settings
             'mail_from_address' => 'nullable|string',
             'mail_from_name' => 'nullable|string',
             'mail_mailer' => 'nullable|string',
-            'mail_enabled' => 'nullable|string',
         ];
     }
 
@@ -105,10 +103,6 @@ class MailSettings extends Settings
                 'type' => 'string',
                 'description' => 'The mailer of your mail server.',
             ],
-            'mail_enabled' => [
-                'label' => 'Mail Enabled',
-                'type' => 'boolean',
-            ],
         ];
     }
 }

+ 0 - 7
app/Settings/ServerSettings.php

@@ -9,7 +9,6 @@ class ServerSettings extends Settings
     public int $allocation_limit;
     public bool $creation_enabled;
     public bool $enable_upgrade;
-    public bool $charge_first_hour;
 
     public static function group(): string
     {
@@ -26,7 +25,6 @@ class ServerSettings extends Settings
             'allocation_limit' => 'required|integer|min:0',
             'creation_enabled' => 'nullable|string',
             'enable_upgrade' => 'nullable|string',
-            'charge_first_hour' => 'nullable|string',
         ];
     }
 
@@ -54,11 +52,6 @@ class ServerSettings extends Settings
                 'type' => 'boolean',
                 'description' => 'Whether or not users can upgrade their servers.',
             ],
-            'charge_first_hour' => [
-                'label' => 'Charge First Hour',
-                'type' => 'boolean',
-                'description' => 'Whether or not the first hour of a server is charged.',
-            ],
         ];
     }
 }

+ 2 - 2
app/Settings/UserSettings.php

@@ -6,6 +6,8 @@ use Spatie\LaravelSettings\Settings;
 
 class UserSettings extends Settings
 {
+    public bool $register_ip_check;
+    public bool $creation_enabled;
     public float $credits_reward_after_verify_discord;
     public float $credits_reward_after_verify_email;
     public bool $force_discord_verification;
@@ -16,8 +18,6 @@ class UserSettings extends Settings
     public int $server_limit_after_irl_purchase;
     public int $server_limit_after_verify_discord;
     public int $server_limit_after_verify_email;
-    public bool $register_ip_check;
-    public bool $creation_enabled;
 
     public static function group(): string
     {

+ 0 - 2
database/migrations/2022_01_05_144858_rename_configurations_table.php

@@ -28,7 +28,6 @@ return new class extends Migration
         DB::table('settings')->where('key', 'REGISTER_IP_CHECK')->update(['key' => 'SETTINGS::SYSTEM:REGISTER_IP_CHECK']);
         DB::table('settings')->where('key', 'CREDITS_DISPLAY_NAME')->update(['key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME']);
         DB::table('settings')->where('key', 'ALLOCATION_LIMIT')->update(['key' => 'SETTINGS::SERVER:ALLOCATION_LIMIT']);
-        DB::table('settings')->where('key', 'SERVER_CREATE_CHARGE_FIRST_HOUR')->update(['key' => 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR']);
         DB::table('settings')->where('key', 'SALES_TAX')->update(['key' => 'SETTINGS::PAYMENTS:SALES_TAX']);
     }
 
@@ -52,7 +51,6 @@ return new class extends Migration
         DB::table('configurations')->where('key', 'SETTINGS::USER:FORCE_EMAIL_VERIFICATION')->update(['key' => 'FORCE_EMAIL_VERIFICATION']);
         DB::table('configurations')->where('key', 'SETTINGS::USER:FORCE_DISCORD_VERIFICATION')->update(['key' => 'FORCE_DISCORD_VERIFICATION']);
         DB::table('configurations')->where('key', 'SETTINGS::SYSTEM:REGISTER_IP_CHECK')->update(['key' => 'REGISTER_IP_CHECK']);
-        DB::table('configurations')->where('key', 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR')->update(['key' => 'SERVER_CREATE_CHARGE_FIRST_HOUR']);
         DB::table('configurations')->where('key', 'SETTINGS::SERVER:ALLOCATION_LIMIT')->update(['key' => 'ALLOCATION_LIMIT']);
         DB::table('configurations')->where('key', 'SETTINGS::SERVER:CREDITS_DISPLAY_NAME')->update(['key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME']);
         DB::table('configurations')->where('key', 'SETTINGS::PAYMENTS:SALES_TAX')->update(['key' => 'SALES_TAX']);

+ 1 - 8
database/settings/2023_02_01_181453_create_mail_settings.php

@@ -18,7 +18,6 @@ class CreateMailSettings extends SettingsMigration
         $this->migrator->add('mail.mail_from_address', $table_exists ? $this->getOldValue('SETTINGS::MAIL:FROM_ADDRESS') : env('MAIL_FROM_ADDRESS', 'example@example.com'));
         $this->migrator->add('mail.mail_from_name', $table_exists ? $this->getOldValue('SETTINGS::MAIL:FROM_NAME') : env('APP_NAME', 'CtrlPanel.gg'));
         $this->migrator->add('mail.mail_mailer', $table_exists ? $this->getOldValue('SETTINGS::MAIL:MAILER') : env('MAIL_MAILER', 'smtp'));
-        $this->migrator->add('mail.mail_enabled', true);
     }
 
     public function down(): void
@@ -72,12 +71,7 @@ class CreateMailSettings extends SettingsMigration
                 'type' => 'string',
                 'description' => 'The mailer of the mail server.',
             ],
-            [
-                'key' => 'SETTINGS::MAIL:ENABLED',
-                'value' => $this->getNewValue('mail_enabled'),
-                'type' => 'boolean',
-                'description' => 'The enabled state of the mail server.',
-            ],
+
         ]);
 
         $this->migrator->delete('mail.mail_host');
@@ -88,7 +82,6 @@ class CreateMailSettings extends SettingsMigration
         $this->migrator->delete('mail.mail_from_address');
         $this->migrator->delete('mail.mail_from_name');
         $this->migrator->delete('mail.mail_mailer');
-        $this->migrator->delete('mail.mail_enabled');
     }
 
 

+ 0 - 8
database/settings/2023_02_01_181950_create_server_settings.php

@@ -13,7 +13,6 @@ class CreateServerSettings extends SettingsMigration
         $this->migrator->add('server.allocation_limit', $table_exists ? $this->getOldValue('SETTINGS::SERVER:ALLOCATION_LIMIT') : 200);
         $this->migrator->add('server.creation_enabled', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS') : true);
         $this->migrator->add('server.enable_upgrade', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:ENABLE_UPGRADE') : false);
-        $this->migrator->add('server.charge_first_hour', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR') : false);
     }
 
     public function down(): void
@@ -37,18 +36,11 @@ class CreateServerSettings extends SettingsMigration
                 'type' => 'boolean',
                 'description' => 'Whether or not users can upgrade their servers.',
             ],
-            [
-                'key' => 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR',
-                'value' => $this->getNewValue('charge_first_hour'),
-                'type' => 'boolean',
-                'description' => 'Whether or not to charge the user for the first hour of their server.',
-            ],
         ]);
 
         $this->migrator->delete('server.allocation_limit');
         $this->migrator->delete('server.creation_enabled');
         $this->migrator->delete('server.enable_upgrade');
-        $this->migrator->delete('server.charge_first_hour');
     }
 
     public function getNewValue(string $name)