Explorar o código

feat: implement laravel-settings

Ferks-FK %!s(int64=2) %!d(string=hai) anos
pai
achega
2229586b58

+ 0 - 40
app/Models/Settings.php

@@ -4,48 +4,8 @@ namespace App\Models;
 
 
 use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\Cache;
 
 
 class Settings extends Model
 class Settings extends Model
 {
 {
     use HasFactory;
     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;
-        });
-    }
 }
 }

+ 84 - 87
app/Providers/AppServiceProvider.php

@@ -2,7 +2,6 @@
 
 
 namespace App\Providers;
 namespace App\Providers;
 
 
-use App\Models\Settings;
 use App\Models\UsefulLink;
 use App\Models\UsefulLink;
 use Exception;
 use Exception;
 use Illuminate\Pagination\Paginator;
 use Illuminate\Pagination\Paginator;
@@ -64,91 +63,89 @@ class AppServiceProvider extends ServiceProvider
         }
         }
 
 
         //only run if the installer has been executed
         //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]);
-            }
-
-            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");
-            }
-
-            // 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');
-            }
-
-            // 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')]);
-
-                Artisan::call('config:clear');
-                Artisan::call('cache:clear');
-            }
-
-            try {
-                $stringfromfile = file(base_path() . '/.git/HEAD');
-
-                $firstLine = $stringfromfile[0]; //get the string from the array
-
-                $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]);
-
-            // 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);
-        }
+        // 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(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')]]);
+
+        //         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);
+        //     }
+
+        //     //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');
+        //     }
+
+        //     try {
+        //         $stringfromfile = file(base_path().'/.git/HEAD');
+
+        //         $firstLine = $stringfromfile[0]; //get the string from the array
+
+        //         $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]);
+
+        //     // 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);
+        // }
     }
     }
 }
 }

+ 29 - 0
app/Settings/GeneralSettings.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace App\Settings;
+
+use Spatie\LaravelSettings\Settings;
+
+class GeneralSettings extends Settings
+{
+    //instead of showing Credits, show something like example 'Emeralds'
+    public string $credits_display_name;
+
+    //url to the main site
+    public string $main_site;
+
+    //check the ip during register for dupes
+    public bool $register_ip_check;
+
+    //the initial amount of credits given to the user on register
+    public float $initial_user_credits;
+    //the initial amount of credits given to the user on register
+    public float $initial_server_limit;
+    //the initial role given to the user on register
+    //public int $initial_user_role; wait for Roles & Permissions PR.
+
+    public static function group(): string
+    {
+        return 'general';
+    }
+}

+ 1 - 0
composer.json

@@ -26,6 +26,7 @@
         "socialiteproviders/discord": "^4.1",
         "socialiteproviders/discord": "^4.1",
         "spatie/laravel-activitylog": "^4.4",
         "spatie/laravel-activitylog": "^4.4",
         "spatie/laravel-query-builder": "^5.0",
         "spatie/laravel-query-builder": "^5.0",
+        "spatie/laravel-settings": "^2.7",
         "spatie/laravel-validation-rules": "^3.2",
         "spatie/laravel-validation-rules": "^3.2",
         "stripe/stripe-php": "^7.107",
         "stripe/stripe-php": "^7.107",
         "symfony/http-client": "^6.2",
         "symfony/http-client": "^6.2",

+ 259 - 2
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
         "This file is @generated automatically"
     ],
     ],
-    "content-hash": "d98e4be75e05c71049fe452b69b54901",
+    "content-hash": "b50b40434baf04e2debcda249af7b595",
     "packages": [
     "packages": [
         {
         {
             "name": "aws/aws-crt-php",
             "name": "aws/aws-crt-php",
@@ -3672,6 +3672,114 @@
             },
             },
             "time": "2022-09-06T12:16:56+00:00"
             "time": "2022-09-06T12:16:56+00:00"
         },
         },
+        {
+            "name": "phpdocumentor/reflection-common",
+            "version": "2.2.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
+                "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
+                "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.2 || ^8.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-2.x": "2.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "phpDocumentor\\Reflection\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jaap van Otterdijk",
+                    "email": "opensource@ijaap.nl"
+                }
+            ],
+            "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
+            "homepage": "http://www.phpdoc.org",
+            "keywords": [
+                "FQSEN",
+                "phpDocumentor",
+                "phpdoc",
+                "reflection",
+                "static analysis"
+            ],
+            "support": {
+                "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
+                "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
+            },
+            "time": "2020-06-27T09:03:43+00:00"
+        },
+        {
+            "name": "phpdocumentor/type-resolver",
+            "version": "1.6.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpDocumentor/TypeResolver.git",
+                "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
+                "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.4 || ^8.0",
+                "phpdocumentor/reflection-common": "^2.0"
+            },
+            "require-dev": {
+                "ext-tokenizer": "*",
+                "phpstan/extension-installer": "^1.1",
+                "phpstan/phpstan": "^1.8",
+                "phpstan/phpstan-phpunit": "^1.1",
+                "phpunit/phpunit": "^9.5",
+                "rector/rector": "^0.13.9",
+                "vimeo/psalm": "^4.25"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-1.x": "1.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "phpDocumentor\\Reflection\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Mike van Riel",
+                    "email": "me@mikevanriel.com"
+                }
+            ],
+            "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
+            "support": {
+                "issues": "https://github.com/phpDocumentor/TypeResolver/issues",
+                "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2"
+            },
+            "time": "2022-10-14T12:47:21+00:00"
+        },
         {
         {
             "name": "phpoption/phpoption",
             "name": "phpoption/phpoption",
             "version": "1.9.0",
             "version": "1.9.0",
@@ -4922,6 +5030,94 @@
             ],
             ],
             "time": "2022-12-02T21:28:40+00:00"
             "time": "2022-12-02T21:28:40+00:00"
         },
         },
+        {
+            "name": "spatie/laravel-settings",
+            "version": "2.7.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/spatie/laravel-settings.git",
+                "reference": "de44cabab1c3ae4f973214c24816db4750c80bd9"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/spatie/laravel-settings/zipball/de44cabab1c3ae4f973214c24816db4750c80bd9",
+                "reference": "de44cabab1c3ae4f973214c24816db4750c80bd9",
+                "shasum": ""
+            },
+            "require": {
+                "doctrine/dbal": "^2.13|^3.2",
+                "ext-json": "*",
+                "illuminate/database": "^8.73|^9.0|^10.0",
+                "php": "^7.4|^8.0",
+                "phpdocumentor/type-resolver": "^1.5",
+                "spatie/temporary-directory": "^1.3|^2.0"
+            },
+            "require-dev": {
+                "ext-redis": "*",
+                "mockery/mockery": "^1.4",
+                "nunomaduro/larastan": "^2.0",
+                "orchestra/testbench": "^6.23|^7.0|^8.0",
+                "pestphp/pest": "^1.21",
+                "pestphp/pest-plugin-laravel": "^1.2",
+                "phpstan/extension-installer": "^1.1",
+                "phpstan/phpstan-deprecation-rules": "^1.0",
+                "phpstan/phpstan-phpunit": "^1.0",
+                "phpunit/phpunit": "^9.5",
+                "spatie/laravel-data": "^1.0.0|^2.0.0",
+                "spatie/pest-plugin-snapshots": "^1.1",
+                "spatie/phpunit-snapshot-assertions": "^4.2",
+                "spatie/ray": "^1.36"
+            },
+            "suggest": {
+                "spatie/data-transfer-object": "Allows for DTO casting to settings. (deprecated)"
+            },
+            "type": "library",
+            "extra": {
+                "laravel": {
+                    "providers": [
+                        "Spatie\\LaravelSettings\\LaravelSettingsServiceProvider"
+                    ]
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Spatie\\LaravelSettings\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Ruben Van Assche",
+                    "email": "ruben@spatie.be",
+                    "homepage": "https://spatie.be",
+                    "role": "Developer"
+                }
+            ],
+            "description": "Store your application settings",
+            "homepage": "https://github.com/spatie/laravel-settings",
+            "keywords": [
+                "laravel-settings",
+                "spatie"
+            ],
+            "support": {
+                "issues": "https://github.com/spatie/laravel-settings/issues",
+                "source": "https://github.com/spatie/laravel-settings/tree/2.7.0"
+            },
+            "funding": [
+                {
+                    "url": "https://spatie.be/open-source/support-us",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://github.com/spatie",
+                    "type": "github"
+                }
+            ],
+            "time": "2023-02-01T12:37:09+00:00"
+        },
         {
         {
             "name": "spatie/laravel-validation-rules",
             "name": "spatie/laravel-validation-rules",
             "version": "3.2.1",
             "version": "3.2.1",
@@ -4994,6 +5190,67 @@
             ],
             ],
             "time": "2022-08-01T11:52:01+00:00"
             "time": "2022-08-01T11:52:01+00:00"
         },
         },
+        {
+            "name": "spatie/temporary-directory",
+            "version": "2.1.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/spatie/temporary-directory.git",
+                "reference": "e2818d871783d520b319c2d38dc37c10ecdcde20"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/spatie/temporary-directory/zipball/e2818d871783d520b319c2d38dc37c10ecdcde20",
+                "reference": "e2818d871783d520b319c2d38dc37c10ecdcde20",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^8.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^9.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Spatie\\TemporaryDirectory\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Alex Vanderbist",
+                    "email": "alex@spatie.be",
+                    "homepage": "https://spatie.be",
+                    "role": "Developer"
+                }
+            ],
+            "description": "Easily create, use and destroy temporary directories",
+            "homepage": "https://github.com/spatie/temporary-directory",
+            "keywords": [
+                "php",
+                "spatie",
+                "temporary-directory"
+            ],
+            "support": {
+                "issues": "https://github.com/spatie/temporary-directory/issues",
+                "source": "https://github.com/spatie/temporary-directory/tree/2.1.1"
+            },
+            "funding": [
+                {
+                    "url": "https://spatie.be/open-source/support-us",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://github.com/spatie",
+                    "type": "github"
+                }
+            ],
+            "time": "2022-08-23T07:15:15+00:00"
+        },
         {
         {
             "name": "stripe/stripe-php",
             "name": "stripe/stripe-php",
             "version": "v7.128.0",
             "version": "v7.128.0",
@@ -10462,5 +10719,5 @@
     "platform-overrides": {
     "platform-overrides": {
         "php": "8.1"
         "php": "8.1"
     },
     },
-    "plugin-api-version": "2.1.0"
+    "plugin-api-version": "2.3.0"
 }
 }

+ 88 - 0
config/settings.php

@@ -0,0 +1,88 @@
+<?php
+
+use App\Settings\GeneralSettings;
+
+return [
+
+    /*
+     * Each settings class used in your application must be registered, you can
+     * put them (manually) here.
+     */
+    'settings' => [
+        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'),
+];

+ 22 - 0
database/migrations/2023_02_01_155140_rename_settings_table.php

@@ -0,0 +1,22 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    public function up()
+    {
+        Schema::table('settings', function (Blueprint $table) {
+            $table->rename('settings_old');
+        });
+    }
+
+    public function down()
+    {
+        Schema::table('settings', function (Blueprint $table) {
+            $table->rename("settings");
+        });
+    }
+};

+ 35 - 0
database/migrations/2023_02_01_155730_create_new_settings_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('settings', function (Blueprint $table) {
+            $table->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');
+    }
+};

+ 631 - 629
database/seeders/Seeds/SettingsSeeder.php

@@ -4,6 +4,7 @@ namespace Database\Seeders\Seeds;
 
 
 use App\Models\Settings;
 use App\Models\Settings;
 use Illuminate\Database\Seeder;
 use Illuminate\Database\Seeder;
+use Illuminate\Support\Facades\DB;
 
 
 class SettingsSeeder extends Seeder
 class SettingsSeeder extends Seeder
 {
 {
@@ -14,6 +15,7 @@ class SettingsSeeder extends Seeder
      */
      */
     public function run()
     public function run()
     {
     {
+        DB::table('settings_old', 'old')->where('');
         //initials
         //initials
         Settings::firstOrCreate([
         Settings::firstOrCreate([
             'key' => 'SETTINGS::USER:INITIAL_CREDITS',
             'key' => 'SETTINGS::USER:INITIAL_CREDITS',
@@ -23,634 +25,634 @@ class SettingsSeeder extends Seeder
             'description' => 'The initial amount of credits the user starts with.',
             '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.',
-        ]);
-
-        //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.',
-        ]);
-
-        //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.',
-        ]);
-
-        //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.',
-        ]);
-
-        //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.',
-        ]);
-
-        //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.'
-        ]);
-
-        //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.',
-        ]);
-
-        //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 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.',
-        ]);
-
-        //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::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: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::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: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::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.'
-
-        ]);
-        Settings::firstOrCreate([
-            'key' => 'SETTINGS::SYSTEM:SHOW_PRIVACY',
-        ], [
-
-            '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: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: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' => '<h1 style="text-align: center;"><img style="display: block; margin-left: auto; margin-right: auto;" src="https://controlpanel.gg/img/controlpanel.png" alt="" width="200" height="200"><span style="font-size: 36pt;">Controlpanel.gg</span></h1>
- <p><span style="font-size: 18pt;">Thank you for using our Software</span></p>
- <p><span style="font-size: 18pt;">If you have any questions, make sure to join our <a href="https://discord.com/invite/4Y6HjD2uyU" target="_blank" rel="noopener">Discord</a></span></p>
- <p><span style="font-size: 10pt;">(you can change this message in the <a href="admin/settings#system">Settings</a> )</span></p>',
-            '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::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.',
+//         ]);
+
+//         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.',
+//         ]);
+
+//         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.',
+//         ]);
+
+//         //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.',
+//         ]);
+
+//         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',
+//         ]);
+
+//         //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: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 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: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/',
+//         ]);
+
+//         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_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: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::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::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',
+//         ], [
+
+//             'value' => "false",
+//             'type'  => 'boolean',
+//             'description'  => 'Enable imprint in footer.'
+
+//         ]);
+//         Settings::firstOrCreate([
+//             'key' => 'SETTINGS::SYSTEM:SHOW_PRIVACY',
+//         ], [
+
+//             '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: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: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' => '<h1 style="text-align: center;"><img style="display: block; margin-left: auto; margin-right: auto;" src="https://controlpanel.gg/img/controlpanel.png" alt="" width="200" height="200"><span style="font-size: 36pt;">Controlpanel.gg</span></h1>
+//  <p><span style="font-size: 18pt;">Thank you for using our Software</span></p>
+//  <p><span style="font-size: 18pt;">If you have any questions, make sure to join our <a href="https://discord.com/invite/4Y6HjD2uyU" target="_blank" rel="noopener">Discord</a></span></p>
+//  <p><span style="font-size: 10pt;">(you can change this message in the <a href="admin/settings#system">Settings</a> )</span></p>',
+//             '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.',
+//         ]);
     }
     }
 }
 }

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

@@ -0,0 +1,26 @@
+<?php
+
+use Spatie\LaravelSettings\Migrations\SettingsMigration;
+use Illuminate\Support\Facades\DB;
+
+class CreateGeneralSettings extends SettingsMigration
+{
+    public function up(): void
+    {
+        // Get the user-set configuration values from the old table.
+        $this->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;
+    }
+}

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

@@ -0,0 +1,25 @@
+<?php
+
+use Spatie\LaravelSettings\Migrations\SettingsMigration;
+use Illuminate\Support\Facades\DB;
+
+class CreatePterodactylSettings extends SettingsMigration
+{
+    public function up(): void
+    {
+        // Get the user-set configuration values from the old table.
+        $this->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;
+    }
+}

+ 30 - 0
database/settings/2023_02_01_181453_create_mail_settings.php

@@ -0,0 +1,30 @@
+<?php
+
+use Spatie\LaravelSettings\Migrations\SettingsMigration;
+use Illuminate\Support\Facades\DB;
+
+class CreateMailSettings extends SettingsMigration
+{
+    public function up(): void
+    {
+        // Get the user-set configuration values from the old table.
+        $this->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;
+    }
+}

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

@@ -0,0 +1,31 @@
+<?php
+
+use Spatie\LaravelSettings\Migrations\SettingsMigration;
+use Illuminate\Support\Facades\DB;
+
+class CreateUserSettings extends SettingsMigration
+{
+    public function up(): void
+    {
+        // Get the user-set configuration values from the old table.
+        $this->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;
+    }
+}

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

@@ -0,0 +1,22 @@
+<?php
+
+use Spatie\LaravelSettings\Migrations\SettingsMigration;
+use Illuminate\Support\Facades\DB;
+
+class CreateServerSettings extends SettingsMigration
+{
+    public function up(): void
+    {
+        // Get the user-set configuration values from the old table.
+        $this->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;
+    }
+}

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

@@ -0,0 +1,29 @@
+<?php
+
+use Spatie\LaravelSettings\Migrations\SettingsMigration;
+use Illuminate\Support\Facades\DB;
+
+class CreateInvoiceSettings extends SettingsMigration
+{
+    public function up(): void
+    {
+        // Get the user-set configuration values from the old table.
+        $this->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;
+    }
+}

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

@@ -0,0 +1,27 @@
+<?php
+
+use Spatie\LaravelSettings\Migrations\SettingsMigration;
+use Illuminate\Support\Facades\DB;
+
+class CreateDiscordSettings extends SettingsMigration
+{
+    public function up(): void
+    {
+        // Get the user-set configuration values from the old table.
+        $this->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;
+    }
+}

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

@@ -0,0 +1,26 @@
+<?php
+
+use Spatie\LaravelSettings\Migrations\SettingsMigration;
+use Illuminate\Support\Facades\DB;
+
+class CreateLocaleSettings extends SettingsMigration
+{
+    public function up(): void
+    {
+        // Get the user-set configuration values from the old table.
+        $this->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;
+    }
+}

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

@@ -0,0 +1,27 @@
+<?php
+
+use Spatie\LaravelSettings\Migrations\SettingsMigration;
+use Illuminate\Support\Facades\DB;
+
+class CreateReferralSettings extends SettingsMigration
+{
+    public function up(): void
+    {
+        // Get the user-set configuration values from the old table.
+        $this->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;
+    }
+}

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

@@ -0,0 +1,22 @@
+<?php
+
+use Spatie\LaravelSettings\Migrations\SettingsMigration;
+use Illuminate\Support\Facades\DB;
+
+class CreateWebsiteSettings extends SettingsMigration
+{
+    public function up(): void
+    {
+        // Get the user-set configuration values from the old table.
+        $this->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;
+    }
+}