ConfigSave.php 2.7 KB

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