ConfigSave.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace App\Http\Requests\Admin;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class ConfigSave extends FormRequest
  5. {
  6. CONST RULES = [
  7. // invite & commission
  8. 'safe_mode_enable' => 'in:0,1',
  9. 'invite_force' => 'in:0,1',
  10. 'invite_commission' => 'integer',
  11. 'invite_gen_limit' => 'integer',
  12. 'invite_never_expire' => 'in:0,1',
  13. 'commission_first_time_enable' => 'in:0,1',
  14. 'commission_auto_check_enable' => 'in:0,1',
  15. // site
  16. 'stop_register' => 'in:0,1',
  17. 'email_verify' => 'in:0,1',
  18. 'app_name' => '',
  19. 'app_description' => '',
  20. 'app_url' => 'nullable|url',
  21. 'subscribe_url' => 'nullable|url',
  22. 'try_out_enable' => 'in:0,1',
  23. 'try_out_plan_id' => 'integer',
  24. 'try_out_hour' => 'numeric',
  25. 'email_whitelist_enable' => 'in:0,1',
  26. 'email_whitelist_suffix' => '',
  27. 'email_gmail_limit_enable' => 'in:0,1',
  28. // subscribe
  29. 'plan_change_enable' => 'in:0,1',
  30. 'reset_traffic_method' => 'in:0,1',
  31. 'renew_reset_traffic_enable' => 'in:0,1',
  32. // server
  33. 'server_token' => 'nullable|min:16',
  34. 'server_license' => 'nullable',
  35. 'server_log_level' => 'nullable|in:debug,info,warning,error,none',
  36. // alipay
  37. 'alipay_enable' => 'in:0,1',
  38. 'alipay_appid' => 'nullable|integer|min:16',
  39. 'alipay_pubkey' => 'max:2048',
  40. 'alipay_privkey' => 'max:2048',
  41. // stripe
  42. 'stripe_alipay_enable' => 'in:0,1',
  43. 'stripe_wepay_enable' => 'in:0,1',
  44. 'stripe_card_enable' => 'in:0,1',
  45. 'stripe_sk_live' => '',
  46. 'stripe_pk_live' => '',
  47. 'stripe_webhook_key' => '',
  48. 'stripe_currency' => 'in:hkd,usd,sgd,eur,gbp',
  49. // bitpayx
  50. 'bitpayx_name' => '',
  51. 'bitpayx_enable' => 'in:0,1',
  52. 'bitpayx_appsecret' => '',
  53. // paytaro
  54. 'paytaro_name' => '',
  55. 'paytaro_enable' => 'in:0,1',
  56. 'paytaro_app_id' => '',
  57. 'paytaro_app_secret' => '',
  58. // frontend
  59. 'frontend_theme_sidebar' => 'in:dark,light',
  60. 'frontend_theme_header' => 'in:dark,light',
  61. 'frontend_theme_color' => 'in:default,darkblue,black',
  62. 'frontend_background_url' => 'nullable|url',
  63. // tutorial
  64. 'apple_id' => 'email',
  65. 'apple_id_password' => '',
  66. // email
  67. 'email_template' => '',
  68. // telegram
  69. 'telegram_bot_enable' => 'in:0,1',
  70. 'telegram_bot_token' => '',
  71. 'telegram_discuss_id' => '',
  72. 'telegram_channel_id' => ''
  73. ];
  74. /**
  75. * Get the validation rules that apply to the request.
  76. *
  77. * @return array
  78. */
  79. public function rules()
  80. {
  81. return self::RULES;
  82. }
  83. public function messages()
  84. {
  85. // illiteracy prompt
  86. return [
  87. 'app_url.url' => '站点URL格式不正确,必须携带http(s)://',
  88. 'subscribe_url.url' => '订阅URL格式不正确,必须携带http(s)://'
  89. ];
  90. }
  91. }