UserSettings.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. namespace App\Settings;
  3. use Spatie\LaravelSettings\Settings;
  4. class UserSettings extends Settings
  5. {
  6. public bool $register_ip_check;
  7. public bool $creation_enabled;
  8. public float $credits_reward_after_verify_discord;
  9. public float $credits_reward_after_verify_email;
  10. public bool $force_discord_verification;
  11. public bool $force_email_verification;
  12. public float $initial_credits;
  13. public int $initial_server_limit;
  14. public float $min_credits_to_make_server;
  15. public int $server_limit_after_irl_purchase;
  16. public int $server_limit_after_verify_discord;
  17. public int $server_limit_after_verify_email;
  18. public static function group(): string
  19. {
  20. return 'user';
  21. }
  22. /**
  23. * Summary of validations array
  24. * @return array<string, string>
  25. */
  26. public static function getValidations()
  27. {
  28. return [
  29. 'credits_reward_after_verify_discord' => 'required|numeric',
  30. 'credits_reward_after_verify_email' => 'required|numeric',
  31. 'force_discord_verification' => 'nullable|string',
  32. 'force_email_verification' => 'nullable|string',
  33. 'initial_credits' => 'required|numeric',
  34. 'initial_server_limit' => 'required|numeric',
  35. 'min_credits_to_make_server' => 'required|numeric',
  36. 'server_limit_after_irl_purchase' => 'required|numeric',
  37. 'server_limit_after_verify_discord' => 'required|numeric',
  38. 'server_limit_after_verify_email' => 'required|numeric',
  39. 'register_ip_check' => 'nullable|string',
  40. 'creation_enabled' => 'nullable|string',
  41. ];
  42. }
  43. /**
  44. * Summary of optionTypes
  45. * Only used for the settings page
  46. * @return array<array<'type'|'label'|'description'|'options', string|boolean|number|array<string, string>>>
  47. */
  48. public static function getOptionInputData()
  49. {
  50. return [
  51. 'category_icon' => 'fas fa-user',
  52. 'credits_reward_after_verify_discord' => [
  53. 'label' => 'Credits Reward After Verify Discord',
  54. 'type' => 'number',
  55. 'description' => 'The amount of credits a user gets after verifying their discord account.',
  56. ],
  57. 'credits_reward_after_verify_email' => [
  58. 'label' => 'Credits Reward After Verify Email',
  59. 'type' => 'number',
  60. 'description' => 'The amount of credits a user gets after verifying their email.',
  61. ],
  62. 'force_discord_verification' => [
  63. 'label' => 'Force Discord Verification',
  64. 'type' => 'boolean',
  65. 'description' => 'Force users to verify their discord account.',
  66. ],
  67. 'force_email_verification' => [
  68. 'label' => 'Force Email Verification',
  69. 'type' => 'boolean',
  70. 'description' => 'Force users to verify their email.',
  71. ],
  72. 'initial_credits' => [
  73. 'label' => 'Initial Credits',
  74. 'type' => 'number',
  75. 'description' => 'The amount of credits a user gets when they register.',
  76. ],
  77. 'initial_server_limit' => [
  78. 'label' => 'Initial Server Limit',
  79. 'type' => 'number',
  80. 'description' => 'The amount of servers a user can create when they register.',
  81. ],
  82. 'min_credits_to_make_server' => [
  83. 'label' => 'Min Credits To Make Server',
  84. 'type' => 'number',
  85. 'description' => 'The minimum amount of credits a user needs to create a server.',
  86. ],
  87. 'server_limit_after_irl_purchase' => [
  88. 'label' => 'Server Limit After first purchase',
  89. 'type' => 'number',
  90. 'description' => 'The amount of servers a user can create after they make their first purchase.',
  91. ],
  92. 'server_limit_after_verify_discord' => [
  93. 'label' => 'Server Limit After Verify Discord',
  94. 'type' => 'number',
  95. 'description' => 'The amount of servers a user can create after they verify their discord account.',
  96. ],
  97. 'server_limit_after_verify_email' => [
  98. 'label' => 'Server Limit After Verify Email',
  99. 'type' => 'number',
  100. 'description' => 'The amount of servers a user can create after they verify their email.',
  101. ],
  102. 'register_ip_check' => [
  103. 'label' => 'Register IP Check Enabled',
  104. 'type' => 'boolean',
  105. 'description' => 'Check if the IP a user is registering from is already in use.',
  106. ],
  107. 'creation_enabled' => [
  108. 'label' => 'Creation Enabled',
  109. 'type' => 'boolean',
  110. 'description' => 'Enable the user registration.',
  111. ],
  112. ];
  113. }
  114. }