ConfigSave.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. // subscribe
  28. 'plan_change_enable' => 'in:0,1',
  29. 'reset_traffic_method' => 'in:0,1',
  30. 'renew_reset_traffic_enable' => 'in:0,1',
  31. // server
  32. 'server_token' => 'nullable|min:16',
  33. 'server_license' => 'nullable',
  34. // alipay
  35. 'alipay_enable' => 'in:0,1',
  36. 'alipay_appid' => 'nullable|integer|min:16',
  37. 'alipay_pubkey' => 'max:2048',
  38. 'alipay_privkey' => 'max:2048',
  39. // stripe
  40. 'stripe_alipay_enable' => 'in:0,1',
  41. 'stripe_wepay_enable' => 'in:0,1',
  42. 'stripe_sk_live' => '',
  43. 'stripe_pk_live' => '',
  44. 'stripe_webhook_key' => '',
  45. 'stripe_currency' => 'in:hkd,usd,sgd,eur,gbp',
  46. // bitpayx
  47. 'bitpayx_name' => '',
  48. 'bitpayx_enable' => 'in:0,1',
  49. 'bitpayx_appsecret' => '',
  50. // paytaro
  51. 'paytaro_name' => '',
  52. 'paytaro_enable' => 'in:0,1',
  53. 'paytaro_app_id' => '',
  54. 'paytaro_app_secret' => '',
  55. // frontend
  56. 'frontend_theme_sidebar' => 'in:dark,light',
  57. 'frontend_theme_header' => 'in:dark,light',
  58. 'frontend_theme_color' => 'in:default,darkblue,black',
  59. 'frontend_background_url' => 'nullable|url',
  60. // tutorial
  61. 'apple_id' => 'email',
  62. 'apple_id_password' => '',
  63. // email
  64. 'email_template' => '',
  65. // telegram
  66. 'telegram_bot_enable' => 'in:0,1',
  67. 'telegram_bot_token' => '',
  68. 'telegram_discuss_id' => '',
  69. 'telegram_channel_id' => ''
  70. ];
  71. /**
  72. * Get the validation rules that apply to the request.
  73. *
  74. * @return array
  75. */
  76. public function rules()
  77. {
  78. return self::RULES;
  79. }
  80. public function messages()
  81. {
  82. // illiteracy prompt
  83. return [
  84. 'app_url.url' => '站点URL格式不正确,必须携带http(s)://',
  85. 'subscribe_url.url' => '订阅URL格式不正确,必须携带http(s)://'
  86. ];
  87. }
  88. }