ConfigSave.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_sk_live' => '',
  45. 'stripe_pk_live' => '',
  46. 'stripe_webhook_key' => '',
  47. 'stripe_currency' => 'in:hkd,usd,sgd,eur,gbp',
  48. // bitpayx
  49. 'bitpayx_name' => '',
  50. 'bitpayx_enable' => 'in:0,1',
  51. 'bitpayx_appsecret' => '',
  52. // paytaro
  53. 'paytaro_name' => '',
  54. 'paytaro_enable' => 'in:0,1',
  55. 'paytaro_app_id' => '',
  56. 'paytaro_app_secret' => '',
  57. // frontend
  58. 'frontend_theme_sidebar' => 'in:dark,light',
  59. 'frontend_theme_header' => 'in:dark,light',
  60. 'frontend_theme_color' => 'in:default,darkblue,black',
  61. 'frontend_background_url' => 'nullable|url',
  62. // tutorial
  63. 'apple_id' => 'email',
  64. 'apple_id_password' => '',
  65. // email
  66. 'email_template' => '',
  67. // telegram
  68. 'telegram_bot_enable' => 'in:0,1',
  69. 'telegram_bot_token' => '',
  70. 'telegram_discuss_id' => '',
  71. 'telegram_channel_id' => ''
  72. ];
  73. /**
  74. * Get the validation rules that apply to the request.
  75. *
  76. * @return array
  77. */
  78. public function rules()
  79. {
  80. return self::RULES;
  81. }
  82. public function messages()
  83. {
  84. // illiteracy prompt
  85. return [
  86. 'app_url.url' => '站点URL格式不正确,必须携带http(s)://',
  87. 'subscribe_url.url' => '订阅URL格式不正确,必须携带http(s)://'
  88. ];
  89. }
  90. }