ServerSettings.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace App\Settings;
  3. use Spatie\LaravelSettings\Settings;
  4. class ServerSettings extends Settings
  5. {
  6. public int $allocation_limit;
  7. public bool $creation_enabled;
  8. public bool $enable_upgrade;
  9. public static function group(): string
  10. {
  11. return 'server';
  12. }
  13. /**
  14. * Summary of validations array
  15. * @return array<string, string>
  16. */
  17. public static function getValidations()
  18. {
  19. return [
  20. 'allocation_limit' => 'required|integer|min:0',
  21. 'creation_enabled' => 'nullable|string',
  22. 'enable_upgrade' => 'nullable|string',
  23. ];
  24. }
  25. /**
  26. * Summary of optionTypes
  27. * Only used for the settings page
  28. * @return array<array<'type'|'label'|'description'|'options', string|bool|float|int|array<string, string>>>
  29. */
  30. public static function getOptionInputData()
  31. {
  32. return [
  33. 'category_icon' => 'fas fa-server',
  34. 'allocation_limit' => [
  35. 'label' => 'Allocation Limit',
  36. 'type' => 'number',
  37. '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.',
  38. ],
  39. 'creation_enabled' => [
  40. 'label' => 'Creation Enabled',
  41. 'type' => 'boolean',
  42. 'description' => 'Enable the user server creation.',
  43. ],
  44. 'enable_upgrade' => [
  45. 'label' => 'Server Upgrade Enabled',
  46. 'type' => 'boolean',
  47. 'description' => 'Enable the server upgrade feature.',
  48. ],
  49. ];
  50. }
  51. }