2023-02-01 19:33:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Settings;
|
|
|
|
|
|
|
|
use Spatie\LaravelSettings\Settings;
|
|
|
|
|
|
|
|
class GeneralSettings extends Settings
|
|
|
|
{
|
|
|
|
public string $main_site;
|
2023-02-03 16:38:03 +00:00
|
|
|
public string $credits_display_name;
|
2023-02-01 19:33:36 +00:00
|
|
|
public float $initial_user_credits;
|
2023-02-03 16:38:03 +00:00
|
|
|
public int $initial_server_limit;
|
2023-02-09 21:34:34 +00:00
|
|
|
public bool $recaptcha_enabled;
|
2023-02-03 16:38:03 +00:00
|
|
|
public string $recaptcha_site_key;
|
|
|
|
public string $recaptcha_secret_key;
|
|
|
|
public string $phpmyadmin_url;
|
|
|
|
public bool $alert_enabled;
|
|
|
|
public string $alert_type;
|
|
|
|
public string $alert_message;
|
|
|
|
public string $theme;
|
|
|
|
|
2023-02-01 19:33:36 +00:00
|
|
|
//public int $initial_user_role; wait for Roles & Permissions PR.
|
|
|
|
|
|
|
|
public static function group(): string
|
|
|
|
{
|
|
|
|
return 'general';
|
|
|
|
}
|
2023-02-03 16:38:03 +00:00
|
|
|
|
|
|
|
public static function encrypted(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'recaptcha_site_key',
|
|
|
|
'recaptcha_secret_key'
|
|
|
|
];
|
|
|
|
}
|
2023-02-09 19:39:58 +00:00
|
|
|
|
2023-02-09 23:31:27 +00:00
|
|
|
/**
|
|
|
|
* Summary of validations array
|
|
|
|
* @return array<string, string>
|
|
|
|
*/
|
2023-02-09 23:04:00 +00:00
|
|
|
public static function getValidations()
|
2023-02-09 19:39:58 +00:00
|
|
|
{
|
|
|
|
return [
|
2023-02-09 23:31:27 +00:00
|
|
|
'main_site' => 'nullable|string',
|
2023-02-09 19:39:58 +00:00
|
|
|
'credits_display_name' => 'required|string',
|
|
|
|
'initial_user_credits' => 'required|numeric',
|
|
|
|
'initial_server_limit' => 'required|numeric',
|
2023-02-09 23:31:27 +00:00
|
|
|
'recaptcha_enabled' => 'nullable|string',
|
|
|
|
'recaptcha_site_key' => 'nullable|string',
|
|
|
|
'recaptcha_secret_key' => 'nullable|string',
|
|
|
|
'phpmyadmin_url' => 'nullable|string',
|
|
|
|
'alert_enabled' => 'nullable|string',
|
|
|
|
'alert_type' => 'nullable|string',
|
|
|
|
'alert_message' => 'nullable|string',
|
|
|
|
'theme' => 'required|string'
|
2023-02-09 19:39:58 +00:00
|
|
|
];
|
|
|
|
}
|
2023-02-09 21:34:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Summary of optionTypes
|
|
|
|
* Only used for the settings page
|
|
|
|
* @return array<array<'type'|'label'|'description'|'options', string|bool|float|int|array<string, string>>>
|
|
|
|
*/
|
|
|
|
public static function getOptionInputData()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'main_site' => [
|
|
|
|
'type' => 'string',
|
|
|
|
'label' => 'Main Site URL',
|
|
|
|
'description' => 'The URL of your main site.'
|
|
|
|
],
|
|
|
|
'credits_display_name' => [
|
|
|
|
'type' => 'string',
|
|
|
|
'label' => 'Credits Display Name',
|
|
|
|
'description' => 'The name of the currency used.'
|
|
|
|
],
|
|
|
|
'initial_user_credits' => [
|
|
|
|
'type' => 'number',
|
|
|
|
'label' => 'Initial User Credits',
|
|
|
|
'description' => 'The amount of credits a user gets when they register.'
|
|
|
|
],
|
|
|
|
'initial_server_limit' => [
|
|
|
|
'type' => 'number',
|
|
|
|
'label' => 'Initial Server Limit',
|
|
|
|
'description' => 'The amount of servers a user can create when they register.'
|
|
|
|
],
|
|
|
|
'recaptcha_enabled' => [
|
|
|
|
'type' => 'boolean',
|
|
|
|
'label' => 'Enable reCAPTCHA',
|
|
|
|
'description' => 'Enable reCAPTCHA on the login page.'
|
|
|
|
],
|
|
|
|
'recaptcha_site_key' => [
|
|
|
|
'type' => 'string',
|
|
|
|
'label' => 'reCAPTCHA Site Key',
|
|
|
|
'description' => 'The site key for reCAPTCHA.'
|
|
|
|
],
|
|
|
|
'recaptcha_secret_key' => [
|
|
|
|
'type' => 'string',
|
|
|
|
'label' => 'reCAPTCHA Secret Key',
|
|
|
|
'description' => 'The secret key for reCAPTCHA.'
|
|
|
|
],
|
|
|
|
'phpmyadmin_url' => [
|
|
|
|
'type' => 'string',
|
|
|
|
'label' => 'phpMyAdmin URL',
|
|
|
|
'description' => 'The URL of your phpMyAdmin installation.'
|
|
|
|
],
|
|
|
|
'alert_enabled' => [
|
|
|
|
'type' => 'boolean',
|
|
|
|
'label' => 'Enable Alert',
|
|
|
|
'description' => 'Enable an alert to be displayed on the home page.'
|
|
|
|
],
|
|
|
|
'alert_type' => [
|
|
|
|
'type' => 'select',
|
|
|
|
'label' => 'Alert Type',
|
|
|
|
'options' => [
|
|
|
|
'primary' => 'Blue',
|
|
|
|
'secondary' => 'Grey',
|
|
|
|
'success' => 'Green',
|
|
|
|
'danger' => 'Red',
|
|
|
|
'warning' => 'Orange',
|
|
|
|
'info' => 'Cyan',
|
|
|
|
],
|
|
|
|
'description' => 'The type of alert to display.'
|
|
|
|
],
|
|
|
|
'alert_message' => [
|
|
|
|
'type' => 'string',
|
|
|
|
'label' => 'Alert Message',
|
|
|
|
'description' => 'The message to display in the alert.'
|
|
|
|
],
|
|
|
|
'theme' => [
|
|
|
|
'type' => 'select',
|
|
|
|
'label' => 'Theme',
|
|
|
|
'options' => [
|
|
|
|
'default' => 'Default',
|
|
|
|
'BlueInfinity' => 'Blue Infinity',
|
|
|
|
],
|
|
|
|
'description' => 'The theme to use for the site.'
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
2023-02-09 19:39:58 +00:00
|
|
|
}
|