Create all the settings files.

This commit is contained in:
Ferks-FK 2023-02-02 15:45:17 +00:00 committed by IceToast
parent 1086dd85a4
commit 8e212889a4
12 changed files with 250 additions and 12 deletions

View file

@ -0,0 +1,25 @@
<?php
namespace app\Settings;
use Spatie\LaravelSettings\Settings;
class DiscordSettings extends Settings
{
public string $bot_token;
public string $client_id;
public string $client_secret;
public int $guild_id;
public string $invite_url;
public int $role_id;
public static function group(): string
{
return 'discord';
}
}

View file

@ -0,0 +1,29 @@
<?php
namespace app\Settings;
use Spatie\LaravelSettings\Settings;
class InvoiceSettings extends Settings
{
public string $company_address;
public string $company_mail;
public string $company_name;
public string $company_phone;
public int $company_vat;
public string $company_website;
public bool $enabled;
public string $prefix;
public static function group(): string
{
return 'invoice';
}
}

View file

@ -0,0 +1,23 @@
<?php
namespace app\Settings;
use Spatie\LaravelSettings\Settings;
class LocaleSettings extends Settings
{
public string $available;
public bool $clients_can_change;
public string $datatables;
public string $default;
public bool $dynamic;
public static function group(): string
{
return 'locale';
}
}

View file

@ -0,0 +1,31 @@
<?php
namespace app\Settings;
use Spatie\LaravelSettings\Settings;
class MailSettings extends Settings
{
public string $mail_host;
public int $mail_port;
public string $mail_username;
public string $mail_password;
public string $mail_encryption;
public string $mail_from_address;
public string $mail_from_name;
public string $mail_mailer;
public bool $mail_enabled;
public static function group(): string
{
return 'mail';
}
}

View file

@ -0,0 +1,21 @@
<?php
namespace app\Settings;
use Spatie\LaravelSettings\Settings;
class PterodactylSettings extends Settings
{
public string $admin_token;
public string $user_token;
public string $panel_url;
public int $per_page_limit;
public static function group(): string
{
return 'pterodactyl';
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace app\Settings;
use Spatie\LaravelSettings\Settings;
class ReferralSettings extends Settings
{
public string $allowed;
public bool $always_give_commission;
public bool $enabled;
public float $reward;
public string $mode;
public int $percentage;
public static function group(): string
{
return 'referral';
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace app\Settings;
use Spatie\LaravelSettings\Settings;
class ServerSettings extends Settings
{
public int $allocation_limit;
public bool $creation_enabled;
public bool $enable_upgrade;
public static function group(): string
{
return 'server';
}
}

View file

@ -0,0 +1,37 @@
<?php
namespace app\Settings;
use Spatie\LaravelSettings\Settings;
class UserSettings extends Settings
{
public float $credits_reward_after_verify_discord;
public float $credits_reward_after_verify_email;
public bool $force_discord_verification;
public bool $force_email_verification;
public float $initial_credits;
public int $initial_server_limit;
public float $min_credits_to_make_server;
public int $server_limit_after_irl_purchase;
public int $server_limit_after_verify_discord;
public int $server_limit_after_verify_email;
public bool $register_ip_check;
public bool $creation_enabled;
public static function group(): string
{
return 'user';
}
}

View file

@ -0,0 +1,29 @@
<?php
namespace app\Settings;
use Spatie\LaravelSettings\Settings;
class WebsiteSettings extends Settings
{
public bool $motd_enabled;
public string $motd_message;
public bool $show_imprint;
public bool $show_privacy;
public bool $show_tos;
public bool $useful_links_enabled;
public string $seo_title;
public string $seo_description;
public static function group(): string
{
return 'website';
}
}

View file

@ -8,14 +8,14 @@ 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_host', ($this->getOldValue('SETTINGS::MAIL:HOST') != null) ?: env('MAIL_HOST', 'localhost'));
$this->migrator->add('mail.mail_port', ($this->getOldValue('SETTINGS::MAIL:PORT') != null) ?: env('MAIL_PORT', '25'));
$this->migrator->add('mail.mail_username', ($this->getOldValue('SETTINGS::MAIL:USERNAME') != null) ?: env('MAIL_USERNAME', ''));
$this->migrator->addEncrypted('mail.mail_password', ($this->getOldValue('SETTINGS::MAIL:PASSWORD') != null) ?: env('MAIL_PASSWORD', ''));
$this->migrator->add('mail.mail_encryption', ($this->getOldValue('SETTINGS::MAIL:ENCRYPTION') != null) ?: env('MAIL_ENCRYPTION', 'tls'));
$this->migrator->add('mail.mail_from_address', ($this->getOldValue('SETTINGS::MAIL:FROM_ADDRESS') != null) ?: env('MAIL_FROM_ADDRESS', ''));
$this->migrator->add('mail.mail_from_name', ($this->getOldValue('SETTINGS::MAIL:FROM_NAME') != null) ?: env('APP_NAME', 'ControlPanel.gg'));
$this->migrator->add('mail.mail_mailer', ($this->getOldValue('SETTINGS::MAIL:MAILER') != null) ?: env('MAIL_MAILER', 'smtp'));
$this->migrator->add('mail.mail_enabled', true);
}

View file

@ -8,9 +8,9 @@ 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->addEncrypted('discord.bot_token', ($this->getOldValue('SETTINGS::DISCORD:BOT_TOKEN') != null) ?: null);
$this->migrator->addEncrypted('discord.client_id', ($this->getOldValue('SETTINGS::DISCORD:CLIENT_ID') != null) ?: null);
$this->migrator->addEncrypted('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);

View file

@ -8,7 +8,6 @@ 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) ?: '');
$this->migrator->add('website.motd_enabled', ($this->getOldValue("SETTINGS::SYSTEM:MOTD_ENABLED") != null) ?: true);
$this->migrator->add('website.motd_message', ($this->getOldValue("SETTINGS::SYSTEM:MOTD_MESSAGE") != null) ?:
'<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>