ConfigSave.php 2.9 KB

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