浏览代码

Correct some types of values from the old table

Ferks-FK 2 年之前
父节点
当前提交
f1a3126758

+ 0 - 1
app/Settings/MailSettings.php

@@ -46,7 +46,6 @@ class MailSettings extends Settings
             config()->set('mail.mailers.smtp.password', $this->mail_password);
             config()->set('mail.from.address', $this->mail_from_address);
             config()->set('mail.from.name', $this->mail_from_name);
-            config()->set('mail.mailers.smtp.transport', $this->mail_mailer);
         } catch (\Exception) {
 
         }

+ 9 - 0
database/settings/2023_02_01_164731_create_general_settings.php

@@ -31,6 +31,15 @@ class CreateGeneralSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }
 

+ 9 - 0
database/settings/2023_02_01_181334_create_pterodactyl_settings.php

@@ -23,6 +23,15 @@ class CreatePterodactylSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }
 

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

@@ -15,7 +15,7 @@ class CreateMailSettings extends SettingsMigration
         $this->migrator->add('mail.mail_username', $table_exists ? $this->getOldValue('SETTINGS::MAIL:USERNAME') : env('MAIL_USERNAME', ''));
         $this->migrator->addEncrypted('mail.mail_password', $table_exists ? $this->getOldValue('SETTINGS::MAIL:PASSWORD') : env('MAIL_PASSWORD', ''));
         $this->migrator->add('mail.mail_encryption', $table_exists ? $this->getOldValue('SETTINGS::MAIL:ENCRYPTION') : env('MAIL_ENCRYPTION', 'tls'));
-        $this->migrator->add('mail.mail_from_address', $table_exists ? $this->getOldValue('SETTINGS::MAIL:FROM_ADDRESS') : env('MAIL_FROM_ADDRESS', ''));
+        $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', 'ControlPanel.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);
@@ -28,6 +28,15 @@ class CreateMailSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }
 

+ 9 - 0
database/settings/2023_02_01_181925_create_user_settings.php

@@ -31,6 +31,15 @@ class CreateUserSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }
 

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

@@ -23,6 +23,15 @@ class CreateServerSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }
 

+ 9 - 0
database/settings/2023_02_01_182021_create_invoice_settings.php

@@ -27,6 +27,15 @@ class CreateInvoiceSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }
 

+ 9 - 0
database/settings/2023_02_01_182043_create_discord_settings.php

@@ -25,6 +25,15 @@ class CreateDiscordSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }
 

+ 9 - 0
database/settings/2023_02_01_182108_create_locale_settings.php

@@ -24,6 +24,15 @@ class CreateLocaleSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }
 

+ 9 - 0
database/settings/2023_02_01_182135_create_referral_settings.php

@@ -25,6 +25,15 @@ class CreateReferralSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }
 

+ 9 - 0
database/settings/2023_02_01_182158_create_website_settings.php

@@ -33,6 +33,15 @@ class CreateWebsiteSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }
 

+ 9 - 0
database/settings/2023_02_04_181156_create_ticket_settings.php

@@ -22,6 +22,15 @@ class CreateTicketSettings extends SettingsMigration
 
         // Handle the old values to return without it being a string in all cases.
         if ($old_value->type === "string" || $old_value->type === "text") {
+            if (is_null($old_value->value)) {
+                return '';
+            }
+
+            // Some values have the type string, but their values are boolean.
+            if ($old_value->value === "false" || $old_value->value === "true") {
+                return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
+            }
+
             return $old_value->value;
         }