ConfigSave.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. namespace App\Http\Requests\Admin;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class ConfigSave extends FormRequest
  5. {
  6. /**
  7. * Get the validation rules that apply to the request.
  8. *
  9. * @return array
  10. */
  11. public function rules()
  12. {
  13. return [
  14. // invite & commission
  15. 'safe_mode_enable' => 'in:0,1',
  16. 'invite_force' => 'in:0,1',
  17. 'invite_commission' => 'integer',
  18. 'invite_gen_limit' => 'integer',
  19. 'invite_never_expire' => 'in:0,1',
  20. 'commission_first_time_enable' => 'in:0,1',
  21. 'commission_auto_check_enable' => 'in:0,1',
  22. 'commission_withdraw_limit' => 'nullable|numeric',
  23. // site
  24. 'stop_register' => 'in:0,1',
  25. 'email_verify' => 'in:0,1',
  26. 'app_name' => '',
  27. 'app_description' => '',
  28. 'app_url' => 'nullable|url',
  29. 'subscribe_url' => 'nullable|url',
  30. 'try_out_enable' => 'in:0,1',
  31. 'try_out_plan_id' => 'integer',
  32. 'try_out_hour' => 'numeric',
  33. 'email_whitelist_enable' => 'in:0,1',
  34. 'email_whitelist_suffix' => '',
  35. 'email_gmail_limit_enable' => 'in:0,1',
  36. 'recaptcha_enable' => 'in:0,1',
  37. 'recaptcha_key' => '',
  38. 'recaptcha_site_key' => '',
  39. // subscribe
  40. 'plan_change_enable' => 'in:0,1',
  41. 'reset_traffic_method' => 'in:0,1',
  42. 'renew_reset_traffic_enable' => 'in:0,1',
  43. 'surplus_enable' => 'in:0,1',
  44. // server
  45. 'server_token' => 'nullable|min:16',
  46. 'server_license' => 'nullable',
  47. 'server_log_enable' => 'in:0,1',
  48. 'server_v2ray_domain' => '',
  49. 'server_v2ray_protocol' => '',
  50. // alipay
  51. 'alipay_enable' => 'in:0,1',
  52. 'alipay_appid' => 'nullable|integer|min:16',
  53. 'alipay_pubkey' => 'max:2048',
  54. 'alipay_privkey' => 'max:2048',
  55. // stripe
  56. 'stripe_alipay_enable' => 'in:0,1',
  57. 'stripe_wepay_enable' => 'in:0,1',
  58. 'stripe_card_enable' => 'in:0,1',
  59. 'stripe_sk_live' => '',
  60. 'stripe_pk_live' => '',
  61. 'stripe_webhook_key' => '',
  62. 'stripe_currency' => 'in:hkd,usd,sgd,eur,gbp,jpy,cad',
  63. // bitpayx
  64. 'bitpayx_name' => '',
  65. 'bitpayx_enable' => 'in:0,1',
  66. 'bitpayx_appsecret' => '',
  67. // mGate
  68. 'mgate_name' => '',
  69. 'mgate_enable' => 'in:0,1',
  70. 'mgate_url' => 'nullable|url',
  71. 'mgate_app_id' => '',
  72. 'mgate_app_secret' => '',
  73. // Epay
  74. 'epay_name' => '',
  75. 'epay_enable' => 'in:0,1',
  76. 'epay_url' => 'nullable|url',
  77. 'epay_pid' => '',
  78. 'epay_key' => '',
  79. // frontend
  80. 'frontend_theme_sidebar' => 'in:dark,light',
  81. 'frontend_theme_header' => 'in:dark,light',
  82. 'frontend_theme_color' => 'in:default,darkblue,black',
  83. 'frontend_background_url' => 'nullable|url',
  84. 'frontend_admin_path' => '',
  85. // tutorial
  86. 'apple_id' => 'nullable|email',
  87. 'apple_id_password' => '',
  88. // email
  89. 'email_template' => '',
  90. 'email_host' => '',
  91. 'email_port' => '',
  92. 'email_username' => '',
  93. 'email_password' => '',
  94. 'email_encryption' => '',
  95. 'email_from_address' => '',
  96. // telegram
  97. 'telegram_bot_enable' => 'in:0,1',
  98. 'telegram_bot_token' => '',
  99. 'telegram_discuss_id' => '',
  100. 'telegram_channel_id' => '',
  101. // app
  102. 'windows_version' => '',
  103. 'windows_download_url' => '',
  104. 'macos_version' => '',
  105. 'macos_download_url' => '',
  106. 'android_version' => '',
  107. 'android_download_url' => ''
  108. ];
  109. }
  110. public function messages()
  111. {
  112. // illiteracy prompt
  113. return [
  114. 'app_url.url' => '站点URL格式不正确,必须携带http(s)://',
  115. 'subscribe_url.url' => '订阅URL格式不正确,必须携带http(s)://'
  116. ];
  117. }
  118. }