DiscordSettings.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace App\Settings;
  3. use Spatie\LaravelSettings\Settings;
  4. class DiscordSettings extends Settings
  5. {
  6. public ?string $bot_token;
  7. public ?string $client_id;
  8. public ?string $client_secret;
  9. public ?string $guild_id;
  10. public ?string $invite_url;
  11. public ?string $role_id;
  12. public static function group(): string
  13. {
  14. return 'discord';
  15. }
  16. /**
  17. * Summary of validations array
  18. * @return array<string, string>
  19. */
  20. public static function getValidations()
  21. {
  22. return [
  23. 'bot_token' => 'nullable|string',
  24. 'client_id' => 'nullable|string',
  25. 'client_secret' => 'nullable|string',
  26. 'guild_id' => 'nullable|string',
  27. 'invite_url' => 'nullable|string|url',
  28. 'role_id' => 'nullable|string',
  29. ];
  30. }
  31. /**
  32. * Summary of optionInputData array
  33. * Only used for the settings page
  34. * @return array<array<'type'|'label'|'description'|'options', string|bool|float|int|array<string, string>>>
  35. */
  36. public static function getOptionInputData()
  37. {
  38. return [
  39. 'category_icon' => 'fas fa-user-friends',
  40. 'bot_token' => [
  41. 'label' => 'Bot Token',
  42. 'type' => 'string',
  43. 'description' => 'The bot token for your Discord bot.',
  44. ],
  45. 'client_id' => [
  46. 'label' => 'Client ID',
  47. 'type' => 'string',
  48. 'description' => 'The client ID for your Discord bot.',
  49. ],
  50. 'client_secret' => [
  51. 'label' => 'Client Secret',
  52. 'type' => 'string',
  53. 'description' => 'The client secret for your Discord bot.',
  54. ],
  55. 'guild_id' => [
  56. 'label' => 'Guild ID',
  57. 'type' => 'string',
  58. 'description' => 'The guild ID for your Discord server.',
  59. ],
  60. 'invite_url' => [
  61. 'label' => 'Invite URL',
  62. 'type' => 'string',
  63. 'description' => 'The invite URL for your Discord server.',
  64. ],
  65. 'role_id' => [
  66. 'label' => 'Role ID',
  67. 'type' => 'string',
  68. 'description' => 'The role ID for your Discord server.',
  69. ],
  70. ];
  71. }
  72. }